| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IPC_IPC_CHANNEL_MOJO_H_ | 5 #ifndef IPC_IPC_CHANNEL_MOJO_H_ |
| 6 #define IPC_IPC_CHANNEL_MOJO_H_ | 6 #define IPC_IPC_CHANNEL_MOJO_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "ipc/ipc_channel.h" | 13 #include "ipc/ipc_channel.h" |
| 14 #include "ipc/ipc_channel_factory.h" | 14 #include "ipc/ipc_channel_factory.h" |
| 15 #include "ipc/ipc_export.h" | 15 #include "ipc/ipc_export.h" |
| 16 #include "ipc/mojo/ipc_message_pipe_reader.h" | 16 #include "ipc/mojo/ipc_message_pipe_reader.h" |
| 17 #include "ipc/mojo/ipc_mojo_bootstrap.h" | 17 #include "ipc/mojo/ipc_mojo_bootstrap.h" |
| 18 #include "ipc/mojo/scoped_ipc_support.h" |
| 18 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h" | 19 #include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h" |
| 19 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" | 20 #include "third_party/mojo/src/mojo/public/cpp/system/core.h" |
| 20 | 21 |
| 21 namespace IPC { | 22 namespace IPC { |
| 22 | 23 |
| 23 // Mojo-based IPC::Channel implementation over a platform handle. | 24 // Mojo-based IPC::Channel implementation over a platform handle. |
| 24 // | 25 // |
| 25 // ChannelMojo builds Mojo MessagePipe using underlying pipe given by | 26 // ChannelMojo builds Mojo MessagePipe using underlying pipe given by |
| 26 // "bootstrap" IPC::Channel which creates and owns platform pipe like | 27 // "bootstrap" IPC::Channel which creates and owns platform pipe like |
| 27 // named socket. The bootstrap Channel is used only for establishing | 28 // named socket. The bootstrap Channel is used only for establishing |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 Listener* listener); | 69 Listener* listener); |
| 69 | 70 |
| 70 // Create a factory object for ChannelMojo. | 71 // Create a factory object for ChannelMojo. |
| 71 // The factory is used to create Mojo-based ChannelProxy family. | 72 // The factory is used to create Mojo-based ChannelProxy family. |
| 72 // |host| must not be null. | 73 // |host| must not be null. |
| 73 static scoped_ptr<ChannelFactory> CreateServerFactory( | 74 static scoped_ptr<ChannelFactory> CreateServerFactory( |
| 74 Delegate* delegate, | 75 Delegate* delegate, |
| 75 const ChannelHandle& channel_handle); | 76 const ChannelHandle& channel_handle); |
| 76 | 77 |
| 77 static scoped_ptr<ChannelFactory> CreateClientFactory( | 78 static scoped_ptr<ChannelFactory> CreateClientFactory( |
| 79 Delegate* delegate, |
| 78 const ChannelHandle& channel_handle); | 80 const ChannelHandle& channel_handle); |
| 79 | 81 |
| 80 ~ChannelMojo() override; | 82 ~ChannelMojo() override; |
| 81 | 83 |
| 82 // ChannelMojoHost tells the client handle using this API. | 84 // ChannelMojoHost tells the client handle using this API. |
| 83 void OnClientLaunched(base::ProcessHandle handle); | 85 void OnClientLaunched(base::ProcessHandle handle); |
| 84 | 86 |
| 85 // Channel implementation | 87 // Channel implementation |
| 86 bool Connect() override; | 88 bool Connect() override; |
| 87 void Close() override; | 89 void Close() override; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::WeakPtr<Delegate> delegate_; | 142 base::WeakPtr<Delegate> delegate_; |
| 141 Mode mode_; | 143 Mode mode_; |
| 142 Listener* listener_; | 144 Listener* listener_; |
| 143 base::ProcessId peer_pid_; | 145 base::ProcessId peer_pid_; |
| 144 scoped_ptr<mojo::embedder::ChannelInfo, | 146 scoped_ptr<mojo::embedder::ChannelInfo, |
| 145 ChannelInfoDeleter> channel_info_; | 147 ChannelInfoDeleter> channel_info_; |
| 146 | 148 |
| 147 scoped_ptr<internal::MessagePipeReader, ReaderDeleter> message_reader_; | 149 scoped_ptr<internal::MessagePipeReader, ReaderDeleter> message_reader_; |
| 148 ScopedVector<Message> pending_messages_; | 150 ScopedVector<Message> pending_messages_; |
| 149 | 151 |
| 152 scoped_ptr<ScopedIPCSupport> ipc_support_; |
| 153 |
| 150 base::WeakPtrFactory<ChannelMojo> weak_factory_; | 154 base::WeakPtrFactory<ChannelMojo> weak_factory_; |
| 151 | 155 |
| 152 DISALLOW_COPY_AND_ASSIGN(ChannelMojo); | 156 DISALLOW_COPY_AND_ASSIGN(ChannelMojo); |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 } // namespace IPC | 159 } // namespace IPC |
| 156 | 160 |
| 157 #endif // IPC_IPC_CHANNEL_MOJO_H_ | 161 #endif // IPC_IPC_CHANNEL_MOJO_H_ |
| OLD | NEW |