Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1605)

Unified Diff: ipc/mojo/ipc_channel_mojo.h

Issue 559723002: Refactoring: Move MessagePipeReader subclasess out from ChannelMojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/mojo/BUILD.gn ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/ipc_channel_mojo.h
diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h
index dd57bc8bf9aa45d3ed57581cc0fc2ab19d1e2e26..22c56a9e6894643e51f6f3838131dc6da513c8ce 100644
--- a/ipc/mojo/ipc_channel_mojo.h
+++ b/ipc/mojo/ipc_channel_mojo.h
@@ -24,6 +24,13 @@ struct ChannelInfo;
namespace IPC {
+namespace internal {
+class ControlReader;
+class ServerControlReader;
+class ClientControlReader;
+class MessageReader;
+}
+
// Mojo-based IPC::Channel implementation over a platform handle.
//
// ChannelMojo builds Mojo MessagePipe using underlying pipe given by
@@ -74,6 +81,15 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
#if defined(OS_POSIX) && !defined(OS_NACL)
virtual int GetClientFileDescriptor() const OVERRIDE;
virtual int TakeClientFileDescriptor() OVERRIDE;
+
+ // These access protected API of IPC::Message, which has ChannelMojo
+ // as a friend class.
+ static MojoResult WriteToFileDescriptorSet(
+ const std::vector<MojoHandle>& handle_buffer,
+ Message* message);
+ static MojoResult ReadFromFileDescriptorSet(const Message& message,
+ std::vector<MojoHandle>* handles);
+
#endif // defined(OS_POSIX) && !defined(OS_NACL)
// Called from MessagePipeReader implementations
@@ -83,6 +99,12 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
void OnPipeError(internal::MessagePipeReader* reader);
void set_peer_pid(base::ProcessId pid) { peer_pid_ = pid; }
+ protected:
+ ChannelMojo(const ChannelHandle& channel_handle,
+ Mode mode,
+ Listener* listener,
+ scoped_refptr<base::TaskRunner> io_thread_task_runner);
+
private:
struct ChannelInfoDeleter {
void operator()(mojo::embedder::ChannelInfo* ptr) const;
@@ -93,14 +115,6 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
// notifications invoked by them.
typedef internal::MessagePipeReader::DelayedDeleter ReaderDeleter;
- class ControlReader;
- class ServerControlReader;
- class ClientControlReader;
- class MessageReader;
-
- ChannelMojo(scoped_ptr<Channel> bootstrap, Mode mode, Listener* listener,
- scoped_refptr<base::TaskRunner> io_thread_task_runner);
-
void InitOnIOThread();
scoped_ptr<Channel> bootstrap_;
@@ -110,8 +124,8 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel {
scoped_ptr<mojo::embedder::ChannelInfo,
ChannelInfoDeleter> channel_info_;
- scoped_ptr<ControlReader, ReaderDeleter> control_reader_;
- scoped_ptr<MessageReader, ReaderDeleter> message_reader_;
+ scoped_ptr<internal::ControlReader, ReaderDeleter> control_reader_;
+ scoped_ptr<internal::MessageReader, ReaderDeleter> message_reader_;
ScopedVector<Message> pending_messages_;
base::WeakPtrFactory<ChannelMojo> weak_factory_;
« no previous file with comments | « ipc/mojo/BUILD.gn ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698