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

Unified Diff: mojo/edk/system/channel_manager.h

Issue 728613002: Make the embedder API use the ChannelManager. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: update comment Created 6 years, 1 month 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 | « mojo/edk/embedder/test_embedder.cc ('k') | mojo/edk/system/channel_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/channel_manager.h
diff --git a/mojo/edk/system/channel_manager.h b/mojo/edk/system/channel_manager.h
index 244f8add8e80638cf1bb0bb8957c718a7a97ec52..60a3048dc3d80aa609190628a1ddd93c96c2a020 100644
--- a/mojo/edk/system/channel_manager.h
+++ b/mojo/edk/system/channel_manager.h
@@ -43,23 +43,32 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelManager {
// Adds |channel| to the set of |Channel|s managed by this |ChannelManager|;
// |channel_thread_task_runner| should be the task runner for |channel|'s
- // creation (a.k.a. I/O) thread.
- //
- // |channel| should either already be initialized or at least already have a
- // task posted to |channel_thread_task_runner| to initialize it. It should not
- // be managed by any |ChannelManager| yet.
- //
- // Returns the ID for the added channel.
+ // creation (a.k.a. I/O) thread. |channel| should either already be
+ // initialized. It should not be managed by any |ChannelManager| yet. Returns
+ // the ID for the added channel.
ChannelId AddChannel(
scoped_refptr<Channel> channel,
scoped_refptr<base::TaskRunner> channel_thread_task_runner);
+ // Informs the channel manager (and thus channel) that it will be shutdown
+ // soon (by calling |ShutdownChannel()|). Calling this is optional (and may in
+ // fact be called multiple times) but it will suppress certain warnings (e.g.,
+ // for the channel being broken) and enable others (if messages are written to
+ // the channel).
+ void WillShutdownChannel(ChannelId channel_id);
+
// Shuts down the channel specified by the given ID. It is up to the caller to
// guarantee that this is only called once per channel (that was added using
- // |AddChannel()|).
+ // |AddChannel()|). If called from the chanel's creation thread (i.e.,
+ // |base::MessageLoopProxy::current()| is the channel thread's |TaskRunner|),
+ // this will complete synchronously.
void ShutdownChannel(ChannelId channel_id);
private:
+ // Gets the |ChannelInfo| for the channel specified by the given ID. (This
+ // should *not* be called under lock.)
+ ChannelInfo GetChannelInfo(ChannelId channel_id);
+
// Note: |Channel| methods should not be called under |lock_|.
base::Lock lock_; // Protects the members below.
« no previous file with comments | « mojo/edk/embedder/test_embedder.cc ('k') | mojo/edk/system/channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698