| Index: third_party/mojo/src/mojo/edk/system/connection_manager.h
|
| diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager.h b/third_party/mojo/src/mojo/edk/system/connection_manager.h
|
| index c92a121aab7560c776cf069a28c2d6a2ab8672a6..5923c75322f2cde4e796b3e33eb73947159c83b3 100644
|
| --- a/third_party/mojo/src/mojo/edk/system/connection_manager.h
|
| +++ b/third_party/mojo/src/mojo/edk/system/connection_manager.h
|
| @@ -5,9 +5,12 @@
|
| #ifndef MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_
|
| #define MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_
|
|
|
| +#include <ostream>
|
| +
|
| #include "mojo/edk/system/connection_identifier.h"
|
| #include "mojo/edk/system/process_identifier.h"
|
| #include "mojo/edk/system/system_impl_export.h"
|
| +#include "mojo/edk/system/thread_annotations.h"
|
| #include "mojo/public/cpp/system/macros.h"
|
|
|
| namespace mojo {
|
| @@ -59,13 +62,23 @@ namespace system {
|
| // slave).
|
| class MOJO_SYSTEM_IMPL_EXPORT ConnectionManager {
|
| public:
|
| + enum class Result {
|
| + FAILURE = 0,
|
| + SUCCESS,
|
| + // These results are used for |Connect()| (which also uses |FAILURE|, but
|
| + // not |SUCCESS|).
|
| + SUCCESS_CONNECT_SAME_PROCESS,
|
| + SUCCESS_CONNECT_NEW_CONNECTION,
|
| + SUCCESS_CONNECT_REUSE_CONNECTION
|
| + };
|
| +
|
| virtual ~ConnectionManager() {}
|
|
|
| ConnectionIdentifier GenerateConnectionIdentifier();
|
|
|
| // Shuts down this connection manager. No other methods may be called after
|
| // this is (or while it is being) called.
|
| - virtual void Shutdown() = 0;
|
| + virtual void Shutdown() MOJO_NOT_THREAD_SAFE = 0;
|
|
|
| // TODO(vtl): Add a "get my own process identifier" method?
|
|
|
| @@ -85,14 +98,14 @@ class MOJO_SYSTEM_IMPL_EXPORT ConnectionManager {
|
| virtual bool CancelConnect(const ConnectionIdentifier& connection_id) = 0;
|
|
|
| // Connects a pending connection; to be called only after both parties have
|
| - // called |AllowConnect()|. On success, |peer_process_identifier| is set to an
|
| - // unique identifier for the peer process, and if the peer process is not the
|
| - // same as the calling process then |*platform_handle| is set to a suitable
|
| - // native handle connecting the two parties (if the two parties are the same
|
| - // process, then |*platform_handle| is reset to be invalid).
|
| - virtual bool Connect(const ConnectionIdentifier& connection_id,
|
| - ProcessIdentifier* peer_process_identifier,
|
| - embedder::ScopedPlatformHandle* platform_handle) = 0;
|
| + // called |AllowConnect()|. On success, |Result::SUCCESS_CONNECT_...| is
|
| + // returned and |peer_process_identifier| is set to an unique identifier for
|
| + // the peer process. In the case of |SUCCESS_CONNECT_SAME_PROCESS|,
|
| + // |*platform_handle| is set to a suitable native handle connecting the two
|
| + // parties.
|
| + virtual Result Connect(const ConnectionIdentifier& connection_id,
|
| + ProcessIdentifier* peer_process_identifier,
|
| + embedder::ScopedPlatformHandle* platform_handle) = 0;
|
|
|
| protected:
|
| // |platform_support| must be valid and remain alive until after |Shutdown()|
|
| @@ -106,6 +119,13 @@ class MOJO_SYSTEM_IMPL_EXPORT ConnectionManager {
|
| MOJO_DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
|
| };
|
|
|
| +// So logging macros and |DCHECK_EQ()|, etc. work.
|
| +MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(
|
| + std::ostream& out,
|
| + ConnectionManager::Result result) {
|
| + return out << static_cast<int>(result);
|
| +}
|
| +
|
| } // namespace system
|
| } // namespace mojo
|
|
|
|
|