Chromium Code Reviews| Index: mojo/embedder/channel_init.h |
| diff --git a/mojo/embedder/channel_init.h b/mojo/embedder/channel_init.h |
| index d06332f1db68f45c91af2ef6de76160eb9c078b6..207c8e108c91d15a70fd435546c4c6b398bd47f8 100644 |
| --- a/mojo/embedder/channel_init.h |
| +++ b/mojo/embedder/channel_init.h |
| @@ -23,8 +23,8 @@ struct ChannelInfo; |
| namespace embedder { |
| -// ChannelInit handle creation (and destruction) of the mojo channel. It is |
| -// expected that this class is created and destroyed on the main thread. |
| +// |ChannelInit| handles creation (and destruction) of the Mojo channel. It is |
| +// not thread-safe, but may be used on any single thread (with a |MessageLoop|). |
| class MOJO_SYSTEM_IMPL_EXPORT ChannelInit { |
| public: |
| ChannelInit(); |
| @@ -36,9 +36,14 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelInit { |
| base::PlatformFile file, |
| scoped_refptr<base::TaskRunner> io_thread_task_runner); |
| + // Notifies the channel that we (hence it) will soon be destroyed. |
| + void WillDestroySoon(); |
| + |
| private: |
| - // Invoked on the main thread once the channel has been established. |
| - static void OnCreatedChannel(base::WeakPtr<ChannelInit> host, |
| + // Invoked on the main thread once the channel has been established. (This is |
|
yzshen1
2014/08/13 19:44:10
nit: maybe it is good to clarify what main thread
|
| + // a static method that takes a weak pointer to self, since we want to destroy |
| + // the channel even if we're destroyed.) |
| + static void OnCreatedChannel(base::WeakPtr<ChannelInit> self, |
| scoped_refptr<base::TaskRunner> io_thread, |
| embedder::ChannelInfo* channel); |