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_MESSAGE_PIPE_ENDPOINT_H_ | 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 6 #define MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "mojo/public/c/system/message_pipe.h" | 15 #include "mojo/public/c/system/message_pipe.h" |
16 #include "mojo/public/c/system/types.h" | 16 #include "mojo/public/c/system/types.h" |
17 #include "mojo/system/dispatcher.h" | 17 #include "mojo/system/dispatcher.h" |
18 #include "mojo/system/memory.h" | 18 #include "mojo/system/memory.h" |
19 #include "mojo/system/message_in_transit.h" | 19 #include "mojo/system/message_in_transit.h" |
20 #include "mojo/system/system_impl_export.h" | 20 #include "mojo/system/system_impl_export.h" |
21 | 21 |
22 namespace mojo { | 22 namespace mojo { |
23 namespace system { | 23 namespace system { |
24 | 24 |
25 class Channel; | |
26 class ChannelEndpoint; | 25 class ChannelEndpoint; |
27 class Waiter; | 26 class Waiter; |
28 | 27 |
29 // This is an interface to one of the ends of a message pipe, and is used by | 28 // This is an interface to one of the ends of a message pipe, and is used by |
30 // |MessagePipe|. Its most important role is to provide a sink for messages | 29 // |MessagePipe|. Its most important role is to provide a sink for messages |
31 // (i.e., a place where messages can be sent). It has a secondary role: When the | 30 // (i.e., a place where messages can be sent). It has a secondary role: When the |
32 // endpoint is local (i.e., in the current process), there'll be a dispatcher | 31 // endpoint is local (i.e., in the current process), there'll be a dispatcher |
33 // corresponding to the endpoint. In that case, the implementation of | 32 // corresponding to the endpoint. In that case, the implementation of |
34 // |MessagePipeEndpoint| also implements the functionality required by the | 33 // |MessagePipeEndpoint| also implements the functionality required by the |
35 // dispatcher, e.g., to read messages and to wait. Implementations of this class | 34 // dispatcher, e.g., to read messages and to wait. Implementations of this class |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual HandleSignalsState GetHandleSignalsState() const; | 67 virtual HandleSignalsState GetHandleSignalsState() const; |
69 virtual MojoResult AddWaiter(Waiter* waiter, | 68 virtual MojoResult AddWaiter(Waiter* waiter, |
70 MojoHandleSignals signals, | 69 MojoHandleSignals signals, |
71 uint32_t context, | 70 uint32_t context, |
72 HandleSignalsState* signals_state); | 71 HandleSignalsState* signals_state); |
73 virtual void RemoveWaiter(Waiter* waiter, HandleSignalsState* signals_state); | 72 virtual void RemoveWaiter(Waiter* waiter, HandleSignalsState* signals_state); |
74 | 73 |
75 // Implementations must override these if they represent a proxy endpoint. An | 74 // Implementations must override these if they represent a proxy endpoint. An |
76 // implementation for a local endpoint needs not override these methods, since | 75 // implementation for a local endpoint needs not override these methods, since |
77 // they should never be called. | 76 // they should never be called. |
78 virtual void Attach(ChannelEndpoint* channel_endpoint, | 77 virtual void Attach(ChannelEndpoint* channel_endpoint); |
79 Channel* channel, | |
80 MessageInTransit::EndpointId local_id); | |
81 // Returns false if the endpoint should be closed and destroyed, else true. | 78 // Returns false if the endpoint should be closed and destroyed, else true. |
82 virtual bool Run(MessageInTransit::EndpointId remote_id); | 79 virtual bool Run(); |
83 virtual void OnRemove(); | 80 virtual void OnRemove(); |
84 | 81 |
85 protected: | 82 protected: |
86 MessagePipeEndpoint() {} | 83 MessagePipeEndpoint() {} |
87 | 84 |
88 private: | 85 private: |
89 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); | 86 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); |
90 }; | 87 }; |
91 | 88 |
92 } // namespace system | 89 } // namespace system |
93 } // namespace mojo | 90 } // namespace mojo |
94 | 91 |
95 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ | 92 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ |
OLD | NEW |