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

Side by Side Diff: mojo/edk/system/channel_manager.h

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_
6 #define MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ 6 #define MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // TODO(vtl): Consider if this is really necessary, since it only has one use 63 // TODO(vtl): Consider if this is really necessary, since it only has one use
64 // (in tests). 64 // (in tests).
65 void Shutdown(const base::Closure& callback, 65 void Shutdown(const base::Closure& callback,
66 scoped_refptr<base::TaskRunner> callback_thread_task_runner); 66 scoped_refptr<base::TaskRunner> callback_thread_task_runner);
67 67
68 // Creates a |Channel| and adds it to the set of channels managed by this 68 // Creates a |Channel| and adds it to the set of channels managed by this
69 // |ChannelManager|. This must be called from the I/O thread (given to the 69 // |ChannelManager|. This must be called from the I/O thread (given to the
70 // constructor). |channel_id| should be a valid |ChannelId| (i.e., nonzero) 70 // constructor). |channel_id| should be a valid |ChannelId| (i.e., nonzero)
71 // not "assigned" to any other |Channel| being managed by this 71 // not "assigned" to any other |Channel| being managed by this
72 // |ChannelManager|. 72 // |ChannelManager|.
73 scoped_refptr<MessagePipeDispatcher> CreateChannelOnIOThread( 73 RefPtr<MessagePipeDispatcher> CreateChannelOnIOThread(
74 ChannelId channel_id, 74 ChannelId channel_id,
75 embedder::ScopedPlatformHandle platform_handle); 75 embedder::ScopedPlatformHandle platform_handle);
76 76
77 // Like |CreateChannelOnIOThread()|, but doesn't create a bootstrap message 77 // Like |CreateChannelOnIOThread()|, but doesn't create a bootstrap message
78 // pipe. Returns the newly-created |Channel|. 78 // pipe. Returns the newly-created |Channel|.
79 // TODO(vtl): Maybe get rid of the others (and bootstrap message pipes in 79 // TODO(vtl): Maybe get rid of the others (and bootstrap message pipes in
80 // general). 80 // general).
81 RefPtr<Channel> CreateChannelWithoutBootstrapOnIOThread( 81 RefPtr<Channel> CreateChannelWithoutBootstrapOnIOThread(
82 ChannelId channel_id, 82 ChannelId channel_id,
83 embedder::ScopedPlatformHandle platform_handle); 83 embedder::ScopedPlatformHandle platform_handle);
84 84
85 // Like |CreateChannelOnIOThread()|, but may be called from any thread. On 85 // Like |CreateChannelOnIOThread()|, but may be called from any thread. On
86 // completion, will call |callback| (using |callback_thread_task_runner| if it 86 // completion, will call |callback| (using |callback_thread_task_runner| if it
87 // is non-null, else on the I/O thread). Note: This will always post a task to 87 // is non-null, else on the I/O thread). Note: This will always post a task to
88 // the I/O thread, even if called from that thread. 88 // the I/O thread, even if called from that thread.
89 scoped_refptr<MessagePipeDispatcher> CreateChannel( 89 RefPtr<MessagePipeDispatcher> CreateChannel(
90 ChannelId channel_id, 90 ChannelId channel_id,
91 embedder::ScopedPlatformHandle platform_handle, 91 embedder::ScopedPlatformHandle platform_handle,
92 const base::Closure& callback, 92 const base::Closure& callback,
93 scoped_refptr<base::TaskRunner> callback_thread_task_runner); 93 scoped_refptr<base::TaskRunner> callback_thread_task_runner);
94 94
95 // Gets the |Channel| with the given ID (which must exist). 95 // Gets the |Channel| with the given ID (which must exist).
96 RefPtr<Channel> GetChannel(ChannelId channel_id) const; 96 RefPtr<Channel> GetChannel(ChannelId channel_id) const;
97 97
98 // Informs the channel manager (and thus channel) that it will be shutdown 98 // Informs the channel manager (and thus channel) that it will be shutdown
99 // soon (by calling |ShutdownChannel()|). Calling this is optional (and may in 99 // soon (by calling |ShutdownChannel()|). Calling this is optional (and may in
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 using ChannelIdToChannelMap = std::unordered_map<ChannelId, RefPtr<Channel>>; 157 using ChannelIdToChannelMap = std::unordered_map<ChannelId, RefPtr<Channel>>;
158 ChannelIdToChannelMap channels_ MOJO_GUARDED_BY(mutex_); 158 ChannelIdToChannelMap channels_ MOJO_GUARDED_BY(mutex_);
159 159
160 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelManager); 160 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
161 }; 161 };
162 162
163 } // namespace system 163 } // namespace system
164 } // namespace mojo 164 } // namespace mojo
165 165
166 #endif // MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_ 166 #endif // MOJO_EDK_SYSTEM_CHANNEL_MANAGER_H_
OLDNEW
« no previous file with comments | « mojo/edk/embedder/system_impl_private_entrypoints.cc ('k') | mojo/edk/system/channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698