| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ |
| 6 #define MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ | 6 #define MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "mojo/edk/system/connection_identifier.h" | 10 #include "mojo/edk/system/connection_identifier.h" |
| 11 #include "mojo/edk/system/process_identifier.h" | 11 #include "mojo/edk/system/process_identifier.h" |
| 12 #include "mojo/edk/util/thread_annotations.h" | 12 #include "mojo/edk/util/thread_annotations.h" |
| 13 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 | 16 |
| 17 namespace embedder { | 17 namespace embedder { |
| 18 class PlatformSupport; | 18 class PlatformSupport; |
| 19 } // namespace embedder |
| 20 |
| 21 namespace platform { |
| 19 class ScopedPlatformHandle; | 22 class ScopedPlatformHandle; |
| 20 } // namespace embedder | 23 } // namespace embedder |
| 21 | 24 |
| 22 namespace system { | 25 namespace system { |
| 23 | 26 |
| 24 // |ConnectionManager| is an interface for the system that allows "connections" | 27 // |ConnectionManager| is an interface for the system that allows "connections" |
| 25 // (i.e., native "pipes") to be established between different processes. | 28 // (i.e., native "pipes") to be established between different processes. |
| 26 // | 29 // |
| 27 // The starting point for establishing such a connection is that the two | 30 // The starting point for establishing such a connection is that the two |
| 28 // processes (not necessarily distinct) are provided with a common | 31 // processes (not necessarily distinct) are provided with a common |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // Connects a pending connection; to be called only after both parties have | 102 // Connects a pending connection; to be called only after both parties have |
| 100 // called |AllowConnect()|. On success, |Result::SUCCESS_CONNECT_...| is | 103 // called |AllowConnect()|. On success, |Result::SUCCESS_CONNECT_...| is |
| 101 // returned, |peer_process_identifier| is set to an unique identifier for the | 104 // returned, |peer_process_identifier| is set to an unique identifier for the |
| 102 // peer process, and |is_first| is set to true if this is the first party to | 105 // peer process, and |is_first| is set to true if this is the first party to |
| 103 // call |Connect()|. In the case of |SUCCESS_CONNECT_SAME_PROCESS|, | 106 // call |Connect()|. In the case of |SUCCESS_CONNECT_SAME_PROCESS|, |
| 104 // |*platform_handle| is set to a suitable native handle connecting the two | 107 // |*platform_handle| is set to a suitable native handle connecting the two |
| 105 // parties. | 108 // parties. |
| 106 virtual Result Connect(const ConnectionIdentifier& connection_id, | 109 virtual Result Connect(const ConnectionIdentifier& connection_id, |
| 107 ProcessIdentifier* peer_process_identifier, | 110 ProcessIdentifier* peer_process_identifier, |
| 108 bool* is_first, | 111 bool* is_first, |
| 109 embedder::ScopedPlatformHandle* platform_handle) = 0; | 112 platform::ScopedPlatformHandle* platform_handle) = 0; |
| 110 | 113 |
| 111 protected: | 114 protected: |
| 112 // |platform_support| must be valid and remain alive until after |Shutdown()| | 115 // |platform_support| must be valid and remain alive until after |Shutdown()| |
| 113 // has completed. | 116 // has completed. |
| 114 explicit ConnectionManager(embedder::PlatformSupport* platform_support) | 117 explicit ConnectionManager(embedder::PlatformSupport* platform_support) |
| 115 : platform_support_(platform_support) {} | 118 : platform_support_(platform_support) {} |
| 116 | 119 |
| 117 private: | 120 private: |
| 118 embedder::PlatformSupport* const platform_support_; | 121 embedder::PlatformSupport* const platform_support_; |
| 119 | 122 |
| 120 MOJO_DISALLOW_COPY_AND_ASSIGN(ConnectionManager); | 123 MOJO_DISALLOW_COPY_AND_ASSIGN(ConnectionManager); |
| 121 }; | 124 }; |
| 122 | 125 |
| 123 // So logging macros and |DCHECK_EQ()|, etc. work. | 126 // So logging macros and |DCHECK_EQ()|, etc. work. |
| 124 inline std::ostream& operator<<(std::ostream& out, | 127 inline std::ostream& operator<<(std::ostream& out, |
| 125 ConnectionManager::Result result) { | 128 ConnectionManager::Result result) { |
| 126 return out << static_cast<int>(result); | 129 return out << static_cast<int>(result); |
| 127 } | 130 } |
| 128 | 131 |
| 129 } // namespace system | 132 } // namespace system |
| 130 } // namespace mojo | 133 } // namespace mojo |
| 131 | 134 |
| 132 #endif // MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ | 135 #endif // MOJO_EDK_SYSTEM_CONNECTION_MANAGER_H_ |
| OLD | NEW |