| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "mojo/edk/system/channel_endpoint_id.h" | 11 #include "mojo/edk/system/channel_endpoint_id.h" |
| 12 #include "mojo/edk/system/message_in_transit_queue.h" | 12 #include "mojo/edk/system/message_in_transit_queue.h" |
| 13 #include "mojo/edk/system/mutex.h" | 13 #include "mojo/edk/system/mutex.h" |
| 14 #include "mojo/edk/system/system_impl_export.h" | |
| 15 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
| 16 | 15 |
| 17 namespace mojo { | 16 namespace mojo { |
| 18 namespace system { | 17 namespace system { |
| 19 | 18 |
| 20 class Channel; | 19 class Channel; |
| 21 class ChannelEndpointClient; | 20 class ChannelEndpointClient; |
| 22 class MessageInTransit; | 21 class MessageInTransit; |
| 23 | 22 |
| 24 // TODO(vtl): The plan: | 23 // TODO(vtl): The plan: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // things proceed as in one of the above cases. The endpoint is *not* | 101 // things proceed as in one of the above cases. The endpoint is *not* |
| 103 // a zombie until it is detached (or a "remove" message is received). | 102 // a zombie until it is detached (or a "remove" message is received). |
| 104 // [TODO(vtl): Maybe we can get rid of this case? It'd only not yet be | 103 // [TODO(vtl): Maybe we can get rid of this case? It'd only not yet be |
| 105 // running since under the current scheme it wouldn't have a remote ID | 104 // running since under the current scheme it wouldn't have a remote ID |
| 106 // yet.] | 105 // yet.] |
| 107 // - Note that even if the local side is closed, it may still receive a | 106 // - Note that even if the local side is closed, it may still receive a |
| 108 // "remove" message from the other side (if the other side is closed | 107 // "remove" message from the other side (if the other side is closed |
| 109 // simultaneously, and both sides send "remove" messages). In that | 108 // simultaneously, and both sides send "remove" messages). In that |
| 110 // case, it must still remain alive until it receives the "remove | 109 // case, it must still remain alive until it receives the "remove |
| 111 // ack" (and it must ack the "remove" message that it received). | 110 // ack" (and it must ack the "remove" message that it received). |
| 112 class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint final | 111 class ChannelEndpoint final |
| 113 : public base::RefCountedThreadSafe<ChannelEndpoint> { | 112 : public base::RefCountedThreadSafe<ChannelEndpoint> { |
| 114 public: | 113 public: |
| 115 // Constructor for a |ChannelEndpoint| with the given client (specified by | 114 // Constructor for a |ChannelEndpoint| with the given client (specified by |
| 116 // |client| and |client_port|). Optionally takes messages from | 115 // |client| and |client_port|). Optionally takes messages from |
| 117 // |*message_queue| if |message_queue| is non-null. | 116 // |*message_queue| if |message_queue| is non-null. |
| 118 // | 117 // |
| 119 // |client| may be null if this endpoint will never need to receive messages, | 118 // |client| may be null if this endpoint will never need to receive messages, |
| 120 // in which case |message_queue| should not be null. In that case, this | 119 // in which case |message_queue| should not be null. In that case, this |
| 121 // endpoint will simply send queued messages upon being attached to a | 120 // endpoint will simply send queued messages upon being attached to a |
| 122 // |Channel| and immediately detach itself. | 121 // |Channel| and immediately detach itself. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // messages to the channel. | 214 // messages to the channel. |
| 216 MessageInTransitQueue channel_message_queue_ MOJO_GUARDED_BY(mutex_); | 215 MessageInTransitQueue channel_message_queue_ MOJO_GUARDED_BY(mutex_); |
| 217 | 216 |
| 218 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 217 MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
| 219 }; | 218 }; |
| 220 | 219 |
| 221 } // namespace system | 220 } // namespace system |
| 222 } // namespace mojo | 221 } // namespace mojo |
| 223 | 222 |
| 224 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ | 223 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ |
| OLD | NEW |