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

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

Issue 885453003: Remove ChannelManager::AddChannel(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
Index: mojo/edk/system/channel_manager.cc
diff --git a/mojo/edk/system/channel_manager.cc b/mojo/edk/system/channel_manager.cc
index be25237d6ba776b668aaae4dfaedc9d7defb2098..320b8ce2107319a6e98241900a1f1944865c9929 100644
--- a/mojo/edk/system/channel_manager.cc
+++ b/mojo/edk/system/channel_manager.cc
@@ -50,24 +50,24 @@ void ChannelManager::CreateChannelOnIOThread(
channel->Init(system::RawChannel::Create(platform_handle.Pass()));
channel->SetBootstrapEndpoint(bootstrap_channel_endpoint);
- AddChannel(channel_id, channel, base::MessageLoopProxy::current());
-}
-
-void ChannelManager::AddChannel(
- ChannelId channel_id,
- scoped_refptr<Channel> channel,
- scoped_refptr<base::TaskRunner> channel_thread_task_runner) {
{
base::AutoLock locker(lock_);
CHECK(channel_infos_.find(channel_id) == channel_infos_.end());
channel_infos_[channel_id] =
- ChannelInfo(channel, channel_thread_task_runner);
+ ChannelInfo(channel, base::MessageLoopProxy::current());
}
channel->SetChannelManager(this);
}
+scoped_refptr<Channel> ChannelManager::GetChannel(ChannelId channel_id) const {
+ base::AutoLock locker(lock_);
+ auto it = channel_infos_.find(channel_id);
+ DCHECK(it != channel_infos_.end());
+ return it->second.channel;
+}
+
void ChannelManager::WillShutdownChannel(ChannelId channel_id) {
- GetChannelInfo(channel_id).channel->WillShutdownSoon();
+ GetChannel(channel_id)->WillShutdownSoon();
}
void ChannelManager::ShutdownChannel(ChannelId channel_id) {
@@ -82,12 +82,5 @@ void ChannelManager::ShutdownChannel(ChannelId channel_id) {
ShutdownChannelHelper(channel_info);
}
-ChannelInfo ChannelManager::GetChannelInfo(ChannelId channel_id) {
- base::AutoLock locker(lock_);
- auto it = channel_infos_.find(channel_id);
- DCHECK(it != channel_infos_.end());
- return it->second;
-}
-
} // namespace system
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698