Chromium Code Reviews| Index: mojo/edk/embedder/embedder.h |
| diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h |
| index 11a352ccef0bcb0520683f2eee3ae26810949871..460f70c718041d94049752020f4cfe26306fdf87 100644 |
| --- a/mojo/edk/embedder/embedder.h |
| +++ b/mojo/edk/embedder/embedder.h |
| @@ -32,10 +32,12 @@ MOJO_SYSTEM_IMPL_EXPORT Configuration* GetConfiguration(); |
| // A "channel" is a connection on top of an OS "pipe", on top of which Mojo |
| // message pipes (etc.) can be multiplexed. It must "live" on some I/O thread. |
| // |
| -// There are two "channel" creation/destruction APIs: the synchronous |
| -// |CreateChannelOnIOThread()|/|DestroyChannelOnIOThread()|, which must be |
| -// called from the I/O thread, and the asynchronous |
| -// |CreateChannel()|/|DestroyChannel()|, which may be called from any thread. |
| +// There are two channel creation APIs: |CreateChannelOnIOThread()| creates a |
| +// channel synchronously and must be called from the I/O thread, while |
| +// |CreateChannel()| is asynchronous and may be called from any thread. |
| +// |DestroyChannel()| is used to destroy the channel in either case and may be |
| +// called from any thread, but completes synchronously when called from the I/O |
| +// thread. |
| // |
| // Both creation functions have a |platform_handle| argument, which should be an |
| // OS-dependent handle to one side of a suitable bidirectional OS "pipe" (e.g., |
| @@ -67,9 +69,8 @@ MOJO_SYSTEM_IMPL_EXPORT Configuration* GetConfiguration(); |
| // Creates a channel; must only be called from the I/O thread. |platform_handle| |
| // should be a handle to a connected OS "pipe". Eventually (even on failure), |
| -// the "out" value |*channel_info| should be passed to |
| -// |DestroyChannelOnIOThread()| (or |DestoryChannel()|) to tear down the |
| -// channel. Returns a handle to the bootstrap message pipe. |
| +// the "out" value |*channel_info| should be passed to |DestoryChannel()| to |
| +// tear down the channel. Returns a handle to the bootstrap message pipe. |
| MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
| CreateChannelOnIOThread(ScopedPlatformHandle platform_handle, |
| ChannelInfo** channel_info); |
| @@ -79,32 +80,25 @@ typedef base::Callback<void(ChannelInfo*)> DidCreateChannelCallback; |
| // |platform_handle| should be a handle to a connected OS "pipe". |
| // |io_thread_task_runner| should be the |TaskRunner| for the I/O thread. |
| // |callback| should be the callback to call with the |ChannelInfo*|, which |
| -// should eventually be passed to |DestroyChannel()| (or |
| -// |DestroyChannelOnIOThread()|) to tear down the channel; the callback will be |
| -// called using |callback_thread_task_runner| if that is non-null, or otherwise |
| -// it will be called using |io_thread_task_runner|. Returns a handle to the |
| -// bootstrap message pipe. |
| +// should eventually be passed to |DestroyChannel()| to tear down the channel; |
| +// the callback will be called using |callback_thread_task_runner| if that is |
| +// non-null, or otherwise it will be called using |io_thread_task_runner|. |
| +// Returns a handle to the bootstrap message pipe. |
| MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle |
| CreateChannel(ScopedPlatformHandle platform_handle, |
| scoped_refptr<base::TaskRunner> io_thread_task_runner, |
| DidCreateChannelCallback callback, |
| scoped_refptr<base::TaskRunner> callback_thread_task_runner); |
| -// Destroys a channel that was created using either |CreateChannelOnIOThread()| |
| -// or |CreateChannel()|; must only be called from the I/O thread. |channel_info| |
| -// should be the "out" value from |CreateChannelOnIOThread()| or the value |
| -// provided to the callback to |CreateChannel()|. |
| -MOJO_SYSTEM_IMPL_EXPORT void DestroyChannelOnIOThread( |
| - ChannelInfo* channel_info); |
| - |
| -// Destroys a channel (asynchronously) that was created using |CreateChannel()|; |
| -// may be called from any thread. |channel_info| should be the value provided to |
| -// the callback to |CreateChannel()|. |
| +// Destroys a channel that was created using |CreateChannel()|; may be called |
|
yzshen1
2014/11/13 22:48:32
It seems nice if the comment also covers CreateCha
|
| +// from any thread. |channel_info| should be the value provided to the callback |
| +// to |CreateChannel()|. If called from the I/O thread, this will complete |
| +// synchronously (in particular, it will post no tasks). |
| MOJO_SYSTEM_IMPL_EXPORT void DestroyChannel(ChannelInfo* channel_info); |
| // Inform the channel that it will soon be destroyed (doing so is optional). |
| // This may be called from any thread, but the caller must ensure that this is |
| -// called before |DestroyChannel()| or |DestroyChannelOnIOThread()|. |
| +// called before |DestroyChannel()|. |
| MOJO_SYSTEM_IMPL_EXPORT void WillDestroyChannelSoon(ChannelInfo* channel_info); |
| // Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking |