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

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

Issue 1146163002: Revert "Revert multiple commits:" (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: the fix 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
« no previous file with comments | « mojo/edk/system/connection_manager_unittest.cc ('k') | mojo/edk/system/master_connection_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/master_connection_manager.h
diff --git a/mojo/edk/system/master_connection_manager.h b/mojo/edk/system/master_connection_manager.h
index c6b6863fdf4f672aff76320f51ad7f8e797fd8bc..3210361d4caefc27624ece1d5c2f67b31089573a 100644
--- a/mojo/edk/system/master_connection_manager.h
+++ b/mojo/edk/system/master_connection_manager.h
@@ -61,9 +61,22 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager
// |embedder::MasterProcessDelegate| to track this process. It must remain
// alive until the delegate's |OnSlaveDisconnect()| is called with it as the
// argument. |OnSlaveDisconnect()| will always be called for each slave,
- // assuming proper shutdown.)
+ // assuming proper shutdown. |*slave_process_identifier| will be set to the
+ // process identifier for the newly-added slave.
void AddSlave(embedder::SlaveInfo slave_info,
- embedder::ScopedPlatformHandle platform_handle);
+ embedder::ScopedPlatformHandle platform_handle,
+ ProcessIdentifier* slave_process_identifier);
+
+ // Like |AddSlave()|, but allows a connection to be bootstrapped: both the
+ // master and slave may call |Connect()| with |connection_id| immediately (as
+ // if both had already called |AllowConnect()|). Returns false if |Connect()|
+ // will not be possible.
+ // TODO(vtl): Is |AddSlave()| really needed? (It's probably mostly useful for
+ // tests.)
+ bool AddSlaveAndBootstrap(embedder::SlaveInfo slave_info,
+ embedder::ScopedPlatformHandle platform_handle,
+ const ConnectionIdentifier& connection_id,
+ ProcessIdentifier* slave_process_identifier);
// |ConnectionManager| methods:
void Shutdown() override;
@@ -92,6 +105,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager
// Signals |*event| on completion.
void AddSlaveOnPrivateThread(embedder::SlaveInfo slave_info,
embedder::ScopedPlatformHandle platform_handle,
+ ProcessIdentifier slave_process_identifier,
base::WaitableEvent* event);
// Called by |Helper::OnError()|.
void OnError(ProcessIdentifier process_identifier);
@@ -120,13 +134,14 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager
base::Thread private_thread_;
// The following members are only accessed on |private_thread_|:
- ProcessIdentifier next_process_identifier_;
base::hash_map<ProcessIdentifier, Helper*> helpers_; // Owns its values.
// Protects the members below (except in the constructor, |Init()|,
// |Shutdown()|/|ShutdownOnPrivateThread()|, and the destructor).
base::Lock lock_;
+ ProcessIdentifier next_process_identifier_;
+
struct PendingConnectionInfo;
base::hash_map<ConnectionIdentifier, PendingConnectionInfo*>
pending_connections_; // Owns its values.
« no previous file with comments | « mojo/edk/system/connection_manager_unittest.cc ('k') | mojo/edk/system/master_connection_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698