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

Unified Diff: third_party/mojo/src/mojo/edk/embedder/embedder.cc

Issue 1142043005: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix type conversion errors on win64 for some msvs Created 5 years, 7 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/embedder/embedder.cc
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder.cc b/third_party/mojo/src/mojo/edk/embedder/embedder.cc
index 58919fb29ed8190f5ade215d3d5bde0599f42e67..29c5217dca5d95eead49069df8949a33af03d8a7 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder.cc
@@ -251,11 +251,46 @@ void ShutdownIPCSupport() {
}
void ConnectToSlave(SlaveInfo slave_info,
- ScopedPlatformHandle platform_handle) {
+ ScopedPlatformHandle platform_handle,
+ ScopedPlatformHandle* platform_connection_handle,
+ std::string* platform_connection_id) {
DCHECK(platform_handle.is_valid());
+ DCHECK(platform_connection_handle);
+ DCHECK(platform_connection_id);
DCHECK(internal::g_process_type == ProcessType::MASTER);
- static_cast<system::MasterConnectionManager*>(g_connection_manager)
- ->AddSlave(slave_info, platform_handle.Pass());
+ DCHECK(g_connection_manager);
+
+ system::ConnectionIdentifier connection_id =
+ g_connection_manager->GenerateConnectionIdentifier();
+ system::ProcessIdentifier slave_id = system::kInvalidProcessIdentifier;
+ CHECK(static_cast<system::MasterConnectionManager*>(g_connection_manager)
+ ->AddSlaveAndBootstrap(slave_info, platform_handle.Pass(),
+ connection_id, &slave_id));
+
+ system::ProcessIdentifier peer_id = system::kInvalidProcessIdentifier;
+ CHECK(g_connection_manager->Connect(connection_id, &peer_id,
+ platform_connection_handle));
+ DCHECK_EQ(peer_id, slave_id);
+ DCHECK(platform_connection_handle->is_valid());
+
+ *platform_connection_id = connection_id.ToString();
+}
+
+void ConnectToMaster(const std::string& platform_connection_id,
+ ScopedPlatformHandle* platform_connection_handle) {
+ DCHECK(internal::g_process_type == ProcessType::SLAVE);
+ DCHECK(g_connection_manager);
+
+ bool ok = false;
+ system::ConnectionIdentifier connection_id =
+ system::ConnectionIdentifier::FromString(platform_connection_id, &ok);
+ CHECK(ok);
+
+ system::ProcessIdentifier peer_id;
+ CHECK(g_connection_manager->Connect(connection_id, &peer_id,
+ platform_connection_handle));
+ DCHECK_EQ(peer_id, system::kMasterProcessIdentifier);
+ DCHECK(platform_connection_handle->is_valid());
}
// TODO(vtl): Write tests for this.
« no previous file with comments | « third_party/mojo/src/mojo/edk/embedder/embedder.h ('k') | third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698