Chromium Code Reviews| Index: ipc/ipc_channel_proxy.h |
| diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h |
| index 0c9323304098c2fc18c75f247479a749b1d3f27b..f4570efb69968b20b1a85dd7ba2a3b5691f7f707 100644 |
| --- a/ipc/ipc_channel_proxy.h |
| +++ b/ipc/ipc_channel_proxy.h |
| @@ -123,10 +123,24 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe { |
| // with / allow for this possibility. |
| void Close(); |
| - // Send a message asynchronously. The message is routed to the background |
| - // thread where it is passed to the IPC::Channel's Send method. |
| + // DEPRECATED: Please use either SendNow or SendOnIPCThread to make ordering |
| + // expectations explicit. |
| + // |
| + // This is an alias for for SendOnIPCThread. |
| bool Send(Message* message) override; |
| + // Send a message as soon as possible. This method may send the message |
| + // immediately, or it may defer and send on the IPC thread. Use this when you |
| + // you don't care about strict ordering of the send operation with respect to |
| + // tasks on the IPC thread. This is most commonly what you want. |
| + bool SendNow(Message* message); |
|
piman
2016/05/20 00:35:41
drive-by: it would be nice to take this occasion t
|
| + |
| + // Send a message from the IPC thread. This immediately posts a task to the |
| + // IPC thread task runner to send the message. Use this when you're posting |
| + // other related tasks to the IPC thread and you need to guarantee that the |
| + // send operation is ordered with respect to those tasks. |
| + bool SendOnIPCThread(Message* message); |
| + |
| // Used to intercept messages as they are received on the background thread. |
| // |
| // Ordinarily, messages sent to the ChannelProxy are routed to the matching |
| @@ -181,7 +195,7 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe { |
| void OnDispatchMessage(const Message& message); |
| // Sends |message| from appropriate thread. |
| - void Send(Message* message); |
| + bool Send(Message* message, bool force_io_thread); |
| // Indicates if the underlying channel's Send is thread-safe. |
| bool IsChannelSendThreadSafe() const; |
| @@ -235,7 +249,7 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe { |
| void OnDispatchError(); |
| void OnDispatchBadMessage(const Message& message); |
| - void SendFromThisThread(Message* message); |
| + bool SendFromThisThread(Message* message); |
| void ClearChannel(); |
| scoped_refptr<base::SingleThreadTaskRunner> listener_task_runner_; |
| @@ -296,6 +310,8 @@ class IPC_EXPORT ChannelProxy : public Endpoint, public base::NonThreadSafe { |
| // Always called once immediately after Init. |
| virtual void OnChannelInit(); |
| + bool SendImpl(Message* message, bool force_io_thread); |
| + |
| // 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. |