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

Unified Diff: mojo/embedder/channel_init.h

Issue 472603002: Mojo: Add the ability to notify a Mojo Channel that it's going to be destroyed soon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 6 years, 4 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | mojo/embedder/channel_init.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/embedder/channel_init.h
diff --git a/mojo/embedder/channel_init.h b/mojo/embedder/channel_init.h
index d06332f1db68f45c91af2ef6de76160eb9c078b6..00337c5f0043a9befdfb67ed83d5e7962296f4e8 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 thread on which this object lives once the channel has been
+ // established. (This is 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);
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | mojo/embedder/channel_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698