1 // Copyright 2016 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_NACL_COMMON_NACL_SERVICE_H_ 6 #define COMPONENTS_NACL_COMMON_NACL_SERVICE_H_ 7 8 #include "base/memory/scoped_refptr.h" 9 #include "base/task/single_thread_task_runner.h" 10 #include "mojo/core/embedder/scoped_ipc_support.h" 11 #include "mojo/public/cpp/system/message_pipe.h" 12 13 // Helper which establishes and holds open an IPC connection to the parent 14 // process. This should exist as long as IPC needs to be possible. 15 class NaClService { 16 public: 17 explicit NaClService( 18 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner); 19 ~NaClService(); 20 21 // Returns a message pipe to use for the client endpoint of a legacy IPC 22 // Channel in this process. Must only be called once. 23 mojo::ScopedMessagePipeHandle TakeChannelPipe(); 24 25 private: 26 const mojo::core::ScopedIPCSupport ipc_support_; 27 }; 28 29 #endif // COMPONENTS_NACL_COMMON_NACL_SERVICE_H_ 30