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

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

Issue 1526063003: EDK: Add TaskRunner and PlatformHandleWatcher to RawChannel. (Closed) Base URL: https://github.com/domokit/mojo.git@channel_watcher
Patch Set: Created 5 years 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/system/master_connection_manager.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/master_connection_manager.cc
diff --git a/mojo/edk/system/master_connection_manager.cc b/mojo/edk/system/master_connection_manager.cc
index 34b1aec4dafc25e0c522140afab56cd1fec3c7ab..fcd6b9946c46d4549a82366e8606d02e10cda8c7 100644
--- a/mojo/edk/system/master_connection_manager.cc
+++ b/mojo/edk/system/master_connection_manager.cc
@@ -82,7 +82,8 @@ class MasterConnectionManager::Helper final : public RawChannel::Delegate {
ScopedPlatformHandle platform_handle);
~Helper() override;
- void Init();
+ void Init(RefPtr<TaskRunner>&& task_runner,
+ PlatformHandleWatcher* platform_handle_watcher);
embedder::SlaveInfo Shutdown();
private:
@@ -118,8 +119,10 @@ MasterConnectionManager::Helper::~Helper() {
DCHECK(!raw_channel_);
}
-void MasterConnectionManager::Helper::Init() {
- raw_channel_->Init(this);
+void MasterConnectionManager::Helper::Init(
+ RefPtr<TaskRunner>&& task_runner,
+ PlatformHandleWatcher* platform_handle_watcher) {
+ raw_channel_->Init(std::move(task_runner), platform_handle_watcher, this);
}
embedder::SlaveInfo MasterConnectionManager::Helper::Shutdown() {
@@ -329,7 +332,8 @@ class MasterConnectionManager::ProcessConnections {
MasterConnectionManager::MasterConnectionManager(
embedder::PlatformSupport* platform_support)
: ConnectionManager(platform_support),
- master_process_delegate_(),
+ master_process_delegate_(nullptr),
+ private_thread_platform_handle_watcher_(nullptr),
next_process_identifier_(kFirstSlaveProcessIdentifier) {
connections_[kMasterProcessIdentifier] = new ProcessConnections();
}
@@ -353,10 +357,8 @@ void MasterConnectionManager::Init(
delegate_thread_task_runner_ = std::move(delegate_thread_task_runner);
master_process_delegate_ = master_process_delegate;
- // TODO(vtl): We'll need to plumb this in further.
- PlatformHandleWatcher* platform_handle_watcher = nullptr;
private_thread_ = platform::CreateAndStartIOThread(
- &private_thread_task_runner_, &platform_handle_watcher);
+ &private_thread_task_runner_, &private_thread_platform_handle_watcher_);
}
ProcessIdentifier MasterConnectionManager::AddSlave(
@@ -421,6 +423,7 @@ void MasterConnectionManager::Shutdown() {
private_thread_->Stop();
private_thread_.reset();
private_thread_task_runner_ = nullptr;
+ private_thread_platform_handle_watcher_ = nullptr;
DCHECK(helpers_.empty());
DCHECK(pending_connects_.empty());
master_process_delegate_ = nullptr;
@@ -689,7 +692,8 @@ void MasterConnectionManager::AddSlaveOnPrivateThread(
std::unique_ptr<Helper> helper(new Helper(
this, slave_process_identifier, slave_info, platform_handle.Pass()));
- helper->Init();
+ helper->Init(private_thread_task_runner_.Clone(),
+ private_thread_platform_handle_watcher_);
DCHECK(helpers_.find(slave_process_identifier) == helpers_.end());
helpers_[slave_process_identifier] = helper.release();
« no previous file with comments | « mojo/edk/system/master_connection_manager.h ('k') | mojo/edk/system/raw_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698