| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ |
| 6 #define MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ | 6 #define MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "mojo/edk/embedder/platform_task_runner.h" | 12 #include "mojo/edk/embedder/platform_task_runner.h" |
| 14 #include "mojo/edk/embedder/process_type.h" | 13 #include "mojo/edk/embedder/process_type.h" |
| 15 #include "mojo/edk/embedder/scoped_platform_handle.h" | 14 #include "mojo/edk/embedder/scoped_platform_handle.h" |
| 16 #include "mojo/edk/embedder/slave_info.h" | 15 #include "mojo/edk/embedder/slave_info.h" |
| 17 #include "mojo/edk/system/channel_id.h" | 16 #include "mojo/edk/system/channel_id.h" |
| 18 #include "mojo/edk/system/connection_identifier.h" | 17 #include "mojo/edk/system/connection_identifier.h" |
| 19 #include "mojo/edk/system/process_identifier.h" | 18 #include "mojo/edk/system/process_identifier.h" |
| 20 #include "mojo/edk/system/ref_ptr.h" | 19 #include "mojo/edk/util/ref_ptr.h" |
| 21 #include "mojo/public/cpp/system/macros.h" | 20 #include "mojo/public/cpp/system/macros.h" |
| 22 | 21 |
| 23 namespace mojo { | 22 namespace mojo { |
| 24 | 23 |
| 25 namespace embedder { | 24 namespace embedder { |
| 26 class PlatformSupport; | 25 class PlatformSupport; |
| 27 class ProcessDelegate; | 26 class ProcessDelegate; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace system { | 29 namespace system { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // master's side). | 92 // master's side). |
| 94 // | 93 // |
| 95 // |callback| will be run after the |Channel| is created, either using | 94 // |callback| will be run after the |Channel| is created, either using |
| 96 // |callback_thread_task_runner| (if it is non-null) or on the I/O thread. | 95 // |callback_thread_task_runner| (if it is non-null) or on the I/O thread. |
| 97 // |*channel_id| will be set to the ID for the channel (immediately); the | 96 // |*channel_id| will be set to the ID for the channel (immediately); the |
| 98 // channel may be destroyed using this ID, but only after the callback has | 97 // channel may be destroyed using this ID, but only after the callback has |
| 99 // been run. | 98 // been run. |
| 100 // | 99 // |
| 101 // TODO(vtl): Add some more channel management functionality to this class. | 100 // TODO(vtl): Add some more channel management functionality to this class. |
| 102 // Maybe make this callback interface more sane. | 101 // Maybe make this callback interface more sane. |
| 103 RefPtr<MessagePipeDispatcher> ConnectToSlave( | 102 util::RefPtr<MessagePipeDispatcher> ConnectToSlave( |
| 104 const ConnectionIdentifier& connection_id, | 103 const ConnectionIdentifier& connection_id, |
| 105 embedder::SlaveInfo slave_info, | 104 embedder::SlaveInfo slave_info, |
| 106 embedder::ScopedPlatformHandle platform_handle, | 105 embedder::ScopedPlatformHandle platform_handle, |
| 107 const base::Closure& callback, | 106 const base::Closure& callback, |
| 108 embedder::PlatformTaskRunnerRefPtr callback_thread_task_runner, | 107 embedder::PlatformTaskRunnerRefPtr callback_thread_task_runner, |
| 109 ChannelId* channel_id); | 108 ChannelId* channel_id); |
| 110 | 109 |
| 111 // Called in a slave process to connect it to the master process and thus the | 110 // Called in a slave process to connect it to the master process and thus the |
| 112 // IPC system, creating a |Channel| and an initial message pipe (return a | 111 // IPC system, creating a |Channel| and an initial message pipe (return a |
| 113 // dispatcher for the slave's side). See |ConnectToSlave()|, above. | 112 // dispatcher for the slave's side). See |ConnectToSlave()|, above. |
| 114 // | 113 // |
| 115 // |callback|, |callback_thread_task_runner|, and |channel_id| are as in | 114 // |callback|, |callback_thread_task_runner|, and |channel_id| are as in |
| 116 // |ConnectToSlave()|. | 115 // |ConnectToSlave()|. |
| 117 // | 116 // |
| 118 // TODO(vtl): |ConnectToSlave()|'s channel management TODO also applies here. | 117 // TODO(vtl): |ConnectToSlave()|'s channel management TODO also applies here. |
| 119 RefPtr<MessagePipeDispatcher> ConnectToMaster( | 118 util::RefPtr<MessagePipeDispatcher> ConnectToMaster( |
| 120 const ConnectionIdentifier& connection_id, | 119 const ConnectionIdentifier& connection_id, |
| 121 const base::Closure& callback, | 120 const base::Closure& callback, |
| 122 embedder::PlatformTaskRunnerRefPtr callback_thread_task_runner, | 121 embedder::PlatformTaskRunnerRefPtr callback_thread_task_runner, |
| 123 ChannelId* channel_id); | 122 ChannelId* channel_id); |
| 124 | 123 |
| 125 embedder::ProcessType process_type() const { return process_type_; } | 124 embedder::ProcessType process_type() const { return process_type_; } |
| 126 embedder::ProcessDelegate* process_delegate() const { | 125 embedder::ProcessDelegate* process_delegate() const { |
| 127 return process_delegate_; | 126 return process_delegate_; |
| 128 } | 127 } |
| 129 embedder::PlatformTaskRunner* delegate_thread_task_runner() const { | 128 embedder::PlatformTaskRunner* delegate_thread_task_runner() const { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 std::unique_ptr<ConnectionManager> connection_manager_; | 172 std::unique_ptr<ConnectionManager> connection_manager_; |
| 174 std::unique_ptr<ChannelManager> channel_manager_; | 173 std::unique_ptr<ChannelManager> channel_manager_; |
| 175 | 174 |
| 176 MOJO_DISALLOW_COPY_AND_ASSIGN(IPCSupport); | 175 MOJO_DISALLOW_COPY_AND_ASSIGN(IPCSupport); |
| 177 }; | 176 }; |
| 178 | 177 |
| 179 } // namespace system | 178 } // namespace system |
| 180 } // namespace mojo | 179 } // namespace mojo |
| 181 | 180 |
| 182 #endif // MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ | 181 #endif // MOJO_EDK_SYSTEM_IPC_SUPPORT_H_ |
| OLD | NEW |