Index: ipc/ipc_channel_proxy.h |
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h |
index 4e2ebbff2b31702eb6e4ade9000261838190ceaa..521389ff42be1e3103b0c02e60bce052a3d3e1e9 100644 |
--- a/ipc/ipc_channel_proxy.h |
+++ b/ipc/ipc_channel_proxy.h |
@@ -120,8 +120,21 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { |
Channel::Listener* listener, |
base::MessageLoopProxy* ipc_thread_loop); |
+ // Creates an uninitialized channel proxy. Init must be called to receive |
+ // or send any messages. This two-step setup allows message filters to be |
+ // added before any messages are sent or received. |
+ ChannelProxy(Channel::Listener* listener, |
+ base::MessageLoopProxy* ipc_thread_loop); |
+ |
virtual ~ChannelProxy(); |
+ // Initializes the channel proxy. Only call this once to initialize a channel |
+ // proxy that was not initialized in its constructor. If create_pipe_now is |
+ // true, the pipe is created synchronously. Otherwise it's created on the IO |
+ // thread. |
+ void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, |
+ bool create_pipe_now); |
+ |
// Close the IPC::Channel. This operation completes asynchronously, once the |
// background thread processes the command to close the channel. It is ok to |
// call this method multiple times. Redundant calls are ignored. |
@@ -165,13 +178,8 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { |
protected: |
class Context; |
// 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 IPC::ChannelHandle& channel_handle, |
- Channel::Mode mode, |
- base::MessageLoopProxy* ipc_thread_loop, |
- Context* context, |
- bool create_pipe_now); |
+ // to the internal state. |
+ ChannelProxy(Context* context); |
// Used internally to hold state that is referenced on the IPC thread. |
class Context : public base::RefCountedThreadSafe<Context>, |
@@ -257,15 +265,15 @@ class IPC_EXPORT ChannelProxy : public Message::Sender { |
private: |
friend class SendTask; |
- void Init(const IPC::ChannelHandle& channel_handle, Channel::Mode mode, |
- base::MessageLoopProxy* ipc_thread_loop, bool create_pipe_now); |
- |
// By maintaining this indirection (ref-counted) to our internal state, we |
// can safely be destroyed while the background thread continues to do stuff |
// that involves this data. |
scoped_refptr<Context> context_; |
OutgoingMessageFilter* outgoing_message_filter_; |
+ |
+ // Whether the channel has been initialized. |
+ bool did_init_; |
}; |
} // namespace IPC |