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_EDK_SYSTEM_CHANNEL_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_H_ |
6 #define MOJO_EDK_SYSTEM_CHANNEL_H_ | 6 #define MOJO_EDK_SYSTEM_CHANNEL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
16 #include "mojo/edk/embedder/scoped_platform_handle.h" | 15 #include "mojo/edk/embedder/scoped_platform_handle.h" |
17 #include "mojo/edk/system/channel_endpoint.h" | 16 #include "mojo/edk/system/channel_endpoint.h" |
18 #include "mojo/edk/system/channel_endpoint_id.h" | 17 #include "mojo/edk/system/channel_endpoint_id.h" |
19 #include "mojo/edk/system/incoming_endpoint.h" | 18 #include "mojo/edk/system/incoming_endpoint.h" |
20 #include "mojo/edk/system/message_in_transit.h" | 19 #include "mojo/edk/system/message_in_transit.h" |
21 #include "mojo/edk/system/mutex.h" | 20 #include "mojo/edk/system/mutex.h" |
22 #include "mojo/edk/system/raw_channel.h" | 21 #include "mojo/edk/system/raw_channel.h" |
23 #include "mojo/edk/system/system_impl_export.h" | 22 #include "mojo/edk/system/system_impl_export.h" |
24 #include "mojo/public/c/system/types.h" | 23 #include "mojo/public/c/system/types.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // remote IDs. | 93 // remote IDs. |
95 // | 94 // |
96 // (Bootstrapping is still symmetric, though the sides should obviously | 95 // (Bootstrapping is still symmetric, though the sides should obviously |
97 // interchange local and remote IDs. This can be used to allow multiple | 96 // interchange local and remote IDs. This can be used to allow multiple |
98 // "bootstrap" endpoints, though this is really most useful for testing.) | 97 // "bootstrap" endpoints, though this is really most useful for testing.) |
99 void SetBootstrapEndpointWithIds(scoped_refptr<ChannelEndpoint> endpoint, | 98 void SetBootstrapEndpointWithIds(scoped_refptr<ChannelEndpoint> endpoint, |
100 ChannelEndpointId local_id, | 99 ChannelEndpointId local_id, |
101 ChannelEndpointId remote_id); | 100 ChannelEndpointId remote_id); |
102 | 101 |
103 // This forwards |message| verbatim to |raw_channel_|. | 102 // This forwards |message| verbatim to |raw_channel_|. |
104 bool WriteMessage(scoped_ptr<MessageInTransit> message); | 103 bool WriteMessage(std::unique_ptr<MessageInTransit> message); |
105 | 104 |
106 // See |RawChannel::IsWriteBufferEmpty()|. | 105 // See |RawChannel::IsWriteBufferEmpty()|. |
107 // TODO(vtl): Maybe we shouldn't expose this, and instead have a | 106 // TODO(vtl): Maybe we shouldn't expose this, and instead have a |
108 // |FlushWriteBufferAndShutdown()| or something like that. | 107 // |FlushWriteBufferAndShutdown()| or something like that. |
109 bool IsWriteBufferEmpty(); | 108 bool IsWriteBufferEmpty(); |
110 | 109 |
111 // Removes the given endpoint from this channel (|local_id| and |remote_id| | 110 // Removes the given endpoint from this channel (|local_id| and |remote_id| |
112 // are specified as an optimization; the latter should be an invalid | 111 // are specified as an optimization; the latter should be an invalid |
113 // |ChannelEndpointId| if the endpoint is not yet running). Note: If this is | 112 // |ChannelEndpointId| if the endpoint is not yet running). Note: If this is |
114 // called, the |Channel| will *not* call | 113 // called, the |Channel| will *not* call |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // if/when we wrap). | 273 // if/when we wrap). |
275 RemoteChannelEndpointIdGenerator remote_id_generator_ MOJO_GUARDED_BY(mutex_); | 274 RemoteChannelEndpointIdGenerator remote_id_generator_ MOJO_GUARDED_BY(mutex_); |
276 | 275 |
277 MOJO_DISALLOW_COPY_AND_ASSIGN(Channel); | 276 MOJO_DISALLOW_COPY_AND_ASSIGN(Channel); |
278 }; | 277 }; |
279 | 278 |
280 } // namespace system | 279 } // namespace system |
281 } // namespace mojo | 280 } // namespace mojo |
282 | 281 |
283 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ | 282 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ |
OLD | NEW |