| 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_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
| 6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "mojo/public/system/core.h" | 15 #include "mojo/public/system/core.h" |
| 16 #include "mojo/public/system/system_export.h" | |
| 17 #include "mojo/system/message_in_transit.h" | 16 #include "mojo/system/message_in_transit.h" |
| 18 #include "mojo/system/message_pipe_endpoint.h" | 17 #include "mojo/system/message_pipe_endpoint.h" |
| 18 #include "mojo/system/system_impl_export.h" |
| 19 | 19 |
| 20 namespace mojo { | 20 namespace mojo { |
| 21 namespace system { | 21 namespace system { |
| 22 | 22 |
| 23 class Channel; | 23 class Channel; |
| 24 | 24 |
| 25 // A |ProxyMessagePipeEndpoint| connects an end of a |MessagePipe| to a | 25 // A |ProxyMessagePipeEndpoint| connects an end of a |MessagePipe| to a |
| 26 // |Channel|, over which it transmits and receives data (to/from another | 26 // |Channel|, over which it transmits and receives data (to/from another |
| 27 // |ProxyMessagePipeEndpoint|). So a |MessagePipe| with one endpoint local and | 27 // |ProxyMessagePipeEndpoint|). So a |MessagePipe| with one endpoint local and |
| 28 // the other endpoint remote consists of a |LocalMessagePipeEndpoint| and a | 28 // the other endpoint remote consists of a |LocalMessagePipeEndpoint| and a |
| 29 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via | 29 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via |
| 30 // a |MessagePipeDispatcher|. | 30 // a |MessagePipeDispatcher|. |
| 31 // | 31 // |
| 32 // Like any |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a | 32 // Like any |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a |
| 33 // |MessagePipe|. | 33 // |MessagePipe|. |
| 34 // - A |ProxyMessagePipeEndpoint| starts out *detached*, i.e., not associated | 34 // - A |ProxyMessagePipeEndpoint| starts out *detached*, i.e., not associated |
| 35 // to any |Channel|. When *attached*, it gets a reference to a |Channel| and | 35 // to any |Channel|. When *attached*, it gets a reference to a |Channel| and |
| 36 // is assigned a local ID. A |ProxyMessagePipeEndpoint| must be detached | 36 // is assigned a local ID. A |ProxyMessagePipeEndpoint| must be detached |
| 37 // before destruction; this is done inside |Close()|. | 37 // before destruction; this is done inside |Close()|. |
| 38 // - When attached, a |ProxyMessagePipeEndpoint| starts out not running. When | 38 // - When attached, a |ProxyMessagePipeEndpoint| starts out not running. When |
| 39 // run, it gets a remote ID. | 39 // run, it gets a remote ID. |
| 40 class MOJO_SYSTEM_EXPORT ProxyMessagePipeEndpoint : public MessagePipeEndpoint { | 40 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint |
| 41 : public MessagePipeEndpoint { |
| 41 public: | 42 public: |
| 42 ProxyMessagePipeEndpoint(); | 43 ProxyMessagePipeEndpoint(); |
| 43 virtual ~ProxyMessagePipeEndpoint(); | 44 virtual ~ProxyMessagePipeEndpoint(); |
| 44 | 45 |
| 45 // |MessagePipeEndpoint| implementation: | 46 // |MessagePipeEndpoint| implementation: |
| 46 virtual void Close() OVERRIDE; | 47 virtual void Close() OVERRIDE; |
| 47 virtual bool OnPeerClose() OVERRIDE; | 48 virtual bool OnPeerClose() OVERRIDE; |
| 48 virtual MojoResult CanEnqueueMessage( | 49 virtual MojoResult CanEnqueueMessage( |
| 49 const MessageInTransit* message, | 50 const MessageInTransit* message, |
| 50 const std::vector<Dispatcher*>* dispatchers) OVERRIDE; | 51 const std::vector<Dispatcher*>* dispatchers) OVERRIDE; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // not ready to send them yet. | 91 // not ready to send them yet. |
| 91 std::deque<MessageInTransit*> paused_message_queue_; | 92 std::deque<MessageInTransit*> paused_message_queue_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); | 94 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 } // namespace system | 97 } // namespace system |
| 97 } // namespace mojo | 98 } // namespace mojo |
| 98 | 99 |
| 99 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ | 100 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ |
| OLD | NEW |