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

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

Issue 901843003: Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Partial revert of https://codereview.chromium.org/899993002/ Created 5 years, 10 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: third_party/mojo/src/mojo/edk/system/channel_manager.cc
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager.cc b/third_party/mojo/src/mojo/edk/system/channel_manager.cc
index 4e58f89abe0ce64b9df3dc2883b18195f350f1d0..e3c08016bebf983949a628fc88d899f926e0654f 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager.cc
@@ -5,8 +5,10 @@
#include "mojo/edk/system/channel_manager.h"
#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/location.h"
#include "base/message_loop/message_loop_proxy.h"
+#include "base/task_runner.h"
namespace mojo {
namespace system {
@@ -26,7 +28,8 @@ void ShutdownChannelHelper(const ChannelInfo& channel_info) {
} // namespace
-ChannelManager::ChannelManager() {
+ChannelManager::ChannelManager(embedder::PlatformSupport* platform_support)
+ : platform_support_(platform_support) {
}
ChannelManager::~ChannelManager() {
@@ -35,24 +38,38 @@ ChannelManager::~ChannelManager() {
ShutdownChannelHelper(map_elem.second);
}
-ChannelId ChannelManager::AddChannel(
- scoped_refptr<Channel> channel,
- scoped_refptr<base::TaskRunner> channel_thread_task_runner) {
- ChannelId channel_id = GetChannelId(channel.get());
+void ChannelManager::CreateChannelOnIOThread(
+ ChannelId channel_id,
+ embedder::ScopedPlatformHandle platform_handle,
+ scoped_refptr<system::ChannelEndpoint> bootstrap_channel_endpoint) {
+ DCHECK_NE(channel_id, kInvalidChannelId);
+ DCHECK(platform_handle.is_valid());
+ DCHECK(bootstrap_channel_endpoint);
+
+ // Create and initialize a |system::Channel|.
+ scoped_refptr<system::Channel> channel =
+ new system::Channel(platform_support_);
+ channel->Init(system::RawChannel::Create(platform_handle.Pass()));
+ channel->SetBootstrapEndpoint(bootstrap_channel_endpoint);
{
base::AutoLock locker(lock_);
- DCHECK(channel_infos_.find(channel_id) == channel_infos_.end());
+ 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);
+}
- return channel_id;
+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) {
@@ -67,12 +84,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