diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 19:28:09 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 19:28:09 +0000 |
commit | 42ce94ec8e98df0744cc1dea26b49c084fe185f0 (patch) | |
tree | 8b585da323dc3bbabb3c61a8941aed90e1819648 /ipc/ipc_channel_proxy.h | |
parent | ade3ef65f389b00a101da5eb18a02b966d354b18 (diff) | |
download | chromium_src-42ce94ec8e98df0744cc1dea26b49c084fe185f0.zip chromium_src-42ce94ec8e98df0744cc1dea26b49c084fe185f0.tar.gz chromium_src-42ce94ec8e98df0744cc1dea26b49c084fe185f0.tar.bz2 |
Convert over to channel handles
This hides some of the internals of the posix channels from users, and gets rid
of several #ifdef POSIX blocks. Generally simplifies usage of channels xplatform.
BUG=none
TEST=build
Review URL: http://codereview.chromium.org/5598010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.h')
-rw-r--r-- | ipc/ipc_channel_proxy.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index a85841d..a256ab6 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -10,7 +10,9 @@ #include "base/lock.h" #include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "ipc/ipc_channel.h" +#include "ipc/ipc_channel_handle.h" class MessageLoop; @@ -97,7 +99,7 @@ class ChannelProxy : public Message::Sender { } }; - // Initializes a channel proxy. The channel_id and mode parameters are + // Initializes a channel proxy. The channel_handle and mode parameters are // passed directly to the underlying IPC::Channel. The listener is called on // the thread that creates the ChannelProxy. The filter's OnMessageReceived // method is called on the thread where the IPC::Channel is running. The @@ -105,7 +107,7 @@ class ChannelProxy : public Message::Sender { // on the background thread. Any message not handled by the filter will be // dispatched to the listener. The given message loop indicates where the // IPC::Channel should be created. - ChannelProxy(const std::string& channel_id, + ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, Channel::Listener* listener, MessageLoop* ipc_thread_loop); @@ -143,8 +145,6 @@ class ChannelProxy : public Message::Sender { #if defined(OS_POSIX) // Calls through to the underlying channel's methods. - // TODO(playmobil): For now this is only implemented in the case of - // create_pipe_now = true, we need to figure this out for the latter case. int GetClientFileDescriptor() const; #endif // defined(OS_POSIX) @@ -153,7 +153,7 @@ class ChannelProxy : public Message::Sender { // A subclass uses this constructor if it needs to add more information // to the internal state. If create_pipe_now is true, the pipe is created // immediately. Otherwise it's created on the IO thread. - ChannelProxy(const std::string& channel_id, + ChannelProxy(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, MessageLoop* ipc_thread_loop, Context* context, @@ -201,7 +201,8 @@ class ChannelProxy : public Message::Sender { friend class SendTask; // Create the Channel - void CreateChannel(const std::string& id, const Channel::Mode& mode); + void CreateChannel(const IPC::ChannelHandle& channel_handle, + const Channel::Mode& mode); // Methods called on the IO thread. void OnSendMessage(Message* message_ptr); @@ -219,7 +220,7 @@ class ChannelProxy : public Message::Sender { // List of filters. This is only accessed on the IPC thread. std::vector<scoped_refptr<MessageFilter> > filters_; MessageLoop* ipc_message_loop_; - Channel* channel_; + scoped_ptr<Channel> channel_; std::string channel_id_; int peer_pid_; bool channel_connected_called_; @@ -236,7 +237,7 @@ class ChannelProxy : public Message::Sender { private: friend class SendTask; - void Init(const std::string& channel_id, Channel::Mode mode, + void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, MessageLoop* ipc_thread_loop, bool create_pipe_now); // By maintaining this indirection (ref-counted) to our internal state, we |