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 "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // is called, but other threads may have temporarily "dangling" references). | 47 // is called, but other threads may have temporarily "dangling" references). |
48 // | 48 // |
49 // Note the lock order (in order of allowable acquisition): | 49 // Note the lock order (in order of allowable acquisition): |
50 // |ChannelEndpointClient| (e.g., |MessagePipe|), |ChannelEndpoint|, |Channel|. | 50 // |ChannelEndpointClient| (e.g., |MessagePipe|), |ChannelEndpoint|, |Channel|. |
51 // Thus |Channel| may not call into |ChannelEndpoint| with |Channel|'s lock | 51 // Thus |Channel| may not call into |ChannelEndpoint| with |Channel|'s lock |
52 // held. | 52 // held. |
53 class MOJO_SYSTEM_IMPL_EXPORT Channel | 53 class MOJO_SYSTEM_IMPL_EXPORT Channel |
54 : public base::RefCountedThreadSafe<Channel>, | 54 : public base::RefCountedThreadSafe<Channel>, |
55 public RawChannel::Delegate { | 55 public RawChannel::Delegate { |
56 public: | 56 public: |
57 // |platform_support| (typically owned by |Core|) must remain alive until | 57 // |platform_support| must remain alive until after |Shutdown()| is called. |
58 // after |Shutdown()| is called. | |
59 explicit Channel(embedder::PlatformSupport* platform_support); | 58 explicit Channel(embedder::PlatformSupport* platform_support); |
60 | 59 |
61 // This must be called on the creation thread before any other methods are | 60 // This must be called on the creation thread before any other methods are |
62 // called, and before references to this object are given to any other | 61 // called, and before references to this object are given to any other |
63 // threads. |raw_channel| should be uninitialized. | 62 // threads. |raw_channel| should be uninitialized. |
64 void Init(scoped_ptr<RawChannel> raw_channel); | 63 void Init(scoped_ptr<RawChannel> raw_channel); |
65 | 64 |
66 // Sets the channel manager associated with this channel. This should be set | 65 // Sets the channel manager associated with this channel. This should be set |
67 // at most once and only called before |WillShutdownSoon()| (and | 66 // at most once and only called before |WillShutdownSoon()| (and |
68 // |Shutdown()|). (This is called by the channel manager when adding a | 67 // |Shutdown()|). (This is called by the channel manager when adding a |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // if/when we wrap). | 252 // if/when we wrap). |
254 RemoteChannelEndpointIdGenerator remote_id_generator_; | 253 RemoteChannelEndpointIdGenerator remote_id_generator_; |
255 | 254 |
256 DISALLOW_COPY_AND_ASSIGN(Channel); | 255 DISALLOW_COPY_AND_ASSIGN(Channel); |
257 }; | 256 }; |
258 | 257 |
259 } // namespace system | 258 } // namespace system |
260 } // namespace mojo | 259 } // namespace mojo |
261 | 260 |
262 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ | 261 #endif // MOJO_EDK_SYSTEM_CHANNEL_H_ |
OLD | NEW |