OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ENDPOINT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ |
6 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ | 6 #define MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "mojo/edk/embedder/platform_handle_vector.h" | 12 #include "mojo/edk/embedder/platform_handle_vector.h" |
13 #include "mojo/edk/system/channel_endpoint_id.h" | 13 #include "mojo/edk/system/channel_endpoint_id.h" |
14 #include "mojo/edk/system/message_in_transit_queue.h" | 14 #include "mojo/edk/system/message_in_transit_queue.h" |
15 #include "mojo/edk/system/system_impl_export.h" | 15 #include "mojo/edk/system/system_impl_export.h" |
16 | 16 |
17 namespace mojo { | 17 namespace mojo { |
18 namespace system { | 18 namespace system { |
19 | 19 |
20 class Channel; | 20 class Channel; |
21 class MessageInTransit; | 21 class MessageInTransit; |
22 class MessagePipe; | 22 class MessagePipe; |
23 | 23 |
24 // TODO(vtl): The plan: | 24 // TODO(vtl): The plan: |
25 // - (Done.) Move |Channel::Endpoint| to |ChannelEndpoint|. Make it | 25 // - (Done.) Move |Channel::Endpoint| to |ChannelEndpoint|. Make it |
26 // refcounted, and not copyable. Make |Channel| a friend. Make things work. | 26 // refcounted, and not copyable. Make |Channel| a friend. Make things work. |
27 // - (Done.) Give |ChannelEndpoint| a lock. The lock order (in order of | 27 // - (Done.) Give |ChannelEndpoint| a lock. The lock order (in order of |
28 // allowable acquisition) is: |MessagePipe|, |ChannelEndpoint|, |Channel|. | 28 // allowable acquisition) is: |MessagePipe|, |ChannelEndpoint|, |Channel|. |
29 // - Stop having |Channel| as a friend. | 29 // - (Done) Stop having |Channel| as a friend. |
30 // - Move logic from |ProxyMessagePipeEndpoint| into |ChannelEndpoint|. Right | 30 // - (Done) Move logic from |ProxyMessagePipeEndpoint| into |ChannelEndpoint|. |
31 // now, we have to go through lots of contortions to manipulate state owned | 31 // Right now, we have to go through lots of contortions to manipulate state |
32 // by |ProxyMessagePipeEndpoint| (in particular, |Channel::Endpoint| doesn't | 32 // owned by |ProxyMessagePipeEndpoint| (in particular, |Channel::Endpoint| |
33 // know about the remote ID; the local ID is duplicated in two places). | 33 // doesn't know about the remote ID; the local ID is duplicated in two |
34 // Hollow out |ProxyMessagePipeEndpoint|, and have it just own a reference | 34 // places). Hollow out |ProxyMessagePipeEndpoint|, and have it just own a |
35 // to |ChannelEndpoint| (hence the refcounting). | 35 // reference to |ChannelEndpoint| (hence the refcounting). |
36 // - In essence, |ChannelEndpoint| becomes the thing that knows about | 36 // - In essence, |ChannelEndpoint| becomes the thing that knows about |
37 // channel-specific aspects of an endpoint (notably local and remote IDs, | 37 // channel-specific aspects of an endpoint (notably local and remote IDs, |
38 // and knowledge about handshaking), and mediates between the |Channel| and | 38 // and knowledge about handshaking), and mediates between the |Channel| and |
39 // the |MessagePipe|. | 39 // the |MessagePipe|. |
40 // - In the end state, |Channel| should no longer need to know about | 40 // - In the end state, |Channel| should no longer need to know about |
41 // |MessagePipe| and ports (but only |ChannelEndpoint|) and | 41 // |MessagePipe| and ports (but only |ChannelEndpoint|) and |
42 // |ProxyMessagePipeEndpoint| should no longer need to know about |Channel| | 42 // |ProxyMessagePipeEndpoint| should no longer need to know about |Channel| |
43 // (ditto). | 43 // (ditto). |
44 // | 44 // |
45 // Things as they are now, before I change everything (TODO(vtl): update this | 45 // Things as they are now, before I change everything (TODO(vtl): update this |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // messages. | 188 // messages. |
189 MessageInTransitQueue paused_message_queue_; | 189 MessageInTransitQueue paused_message_queue_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 191 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
192 }; | 192 }; |
193 | 193 |
194 } // namespace system | 194 } // namespace system |
195 } // namespace mojo | 195 } // namespace mojo |
196 | 196 |
197 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ | 197 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ |
OLD | NEW |