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

Unified Diff: ipc/ipc_channel_proxy.h

Issue 2301123004: Mojo Channel: Fix deferred proxy dispatch; support paused channels (Closed)
Patch Set: Created 4 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
Index: ipc/ipc_channel_proxy.h
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index ebbe3e3ae2a97186a849f2ae414a357bfecc3be5..eff2b33a650202bec43d44cb81f4664d6b42ef29 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -111,13 +111,30 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe {
~ChannelProxy() override;
// 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
+ // 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.
+ // thread. If |connect_now| is true, pipe connection is initiated immediately.
yzshen1 2016/09/02 22:03:36 this comment seems outdated.
Ken Rockot(use gerrit already) 2016/09/06 17:21:27 Oops, yes, updated
+ // Otherwise, Connect() must be explicitly called before the channel will
+ // actually send or receive any messages. Send() et al are safe to call before
+ // connection; outgoing messages are queued internally and will be flushed as
+ // soon as connection is complete.
void Init(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
- bool create_pipe_now);
- void Init(std::unique_ptr<ChannelFactory> factory, bool create_pipe_now);
+ bool create_pipe_now,
+ bool create_paused = false);
+ void Init(std::unique_ptr<ChannelFactory> factory,
+ bool create_pipe_now,
+ bool create_paused = false);
+
+ // Unpause the channel. Only useful if Init was called with |create_paused|.
+ // If |flush| is true the channel will be flushed as soon as it's unpaused.
+ // Otherwise you must explicitly call Flush() to flush messages which were
+ // queued while the channel was paused.
+ void Unpause(bool flush);
+
+ // Flush the channel. This sends any messages which were queued before calling
+ // Connect. Only useful if Unpause(false) was called previously.
+ void Flush();
// Close the IPC::Channel. This operation completes asynchronously, once the
// background thread processes the command to close the channel. It is ok to
@@ -274,8 +291,11 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe {
// Returns true if the message was processed, false otherwise.
bool TryFilters(const Message& message);
+ void UnpauseChannel(bool flush);
+ void FlushChannel();
+
// Like Open and Close, but called on the IPC thread.
- virtual void OnChannelOpened();
+ virtual void OnChannelOpened(bool pause);
virtual void OnChannelClosed();
// Called on the consumers thread when the ChannelProxy is closed. At that

Powered by Google App Engine
This is Rietveld 408576698