OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYSTEM_CHANNEL_H_ | 5 #ifndef MOJO_SYSTEM_CHANNEL_H_ |
6 #define MOJO_SYSTEM_CHANNEL_H_ | 6 #define MOJO_SYSTEM_CHANNEL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1; | 61 static const MessageInTransit::EndpointId kBootstrapEndpointId = 1; |
62 | 62 |
63 Channel(); | 63 Channel(); |
64 | 64 |
65 // This must be called on the creation thread before any other methods are | 65 // This must be called on the creation thread before any other methods are |
66 // called, and before references to this object are given to any other | 66 // called, and before references to this object are given to any other |
67 // threads. |handle| should be a handle to a (platform-appropriate) | 67 // threads. |handle| should be a handle to a (platform-appropriate) |
68 // bidirectional communication channel (e.g., a socket on POSIX, a named pipe | 68 // bidirectional communication channel (e.g., a socket on POSIX, a named pipe |
69 // on Windows). Returns true on success. On failure, no other methods should | 69 // on Windows). Returns true on success. On failure, no other methods should |
70 // be called (including |Shutdown()|). | 70 // be called (including |Shutdown()|). |
71 bool Init(ScopedPlatformHandle handle); | 71 bool Init(embedder::ScopedPlatformHandle handle); |
72 | 72 |
73 // This must be called on the creation thread before destruction (which can | 73 // This must be called on the creation thread before destruction (which can |
74 // happen on any thread). | 74 // happen on any thread). |
75 void Shutdown(); | 75 void Shutdown(); |
76 | 76 |
77 // Attaches the given message pipe/port's endpoint (which must be a | 77 // Attaches the given message pipe/port's endpoint (which must be a |
78 // |ProxyMessagePipeEndpoint|) to this channel. This assigns it a local ID, | 78 // |ProxyMessagePipeEndpoint|) to this channel. This assigns it a local ID, |
79 // which it returns. The first message pipe endpoint attached will always have | 79 // which it returns. The first message pipe endpoint attached will always have |
80 // |kBootstrapEndpointId| as its local ID. (For bootstrapping, this occurs on | 80 // |kBootstrapEndpointId| as its local ID. (For bootstrapping, this occurs on |
81 // both sides, so one should use |kBootstrapEndpointId| for the remote ID for | 81 // both sides, so one should use |kBootstrapEndpointId| for the remote ID for |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // be checked for existence before use. | 137 // be checked for existence before use. |
138 MessageInTransit::EndpointId next_local_id_; | 138 MessageInTransit::EndpointId next_local_id_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(Channel); | 140 DISALLOW_COPY_AND_ASSIGN(Channel); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace system | 143 } // namespace system |
144 } // namespace mojo | 144 } // namespace mojo |
145 | 145 |
146 #endif // MOJO_SYSTEM_CHANNEL_H_ | 146 #endif // MOJO_SYSTEM_CHANNEL_H_ |
OLD | NEW |