| 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" | |
| 13 #include "mojo/edk/system/channel_endpoint_id.h" | 12 #include "mojo/edk/system/channel_endpoint_id.h" |
| 14 #include "mojo/edk/system/message_in_transit.h" | |
| 15 #include "mojo/edk/system/message_in_transit_queue.h" | 13 #include "mojo/edk/system/message_in_transit_queue.h" |
| 16 #include "mojo/edk/system/system_impl_export.h" | 14 #include "mojo/edk/system/system_impl_export.h" |
| 17 | 15 |
| 18 namespace mojo { | 16 namespace mojo { |
| 19 namespace system { | 17 namespace system { |
| 20 | 18 |
| 21 class Channel; | 19 class Channel; |
| 22 class ChannelEndpointClient; | 20 class ChannelEndpointClient; |
| 23 class MessageInTransit; | 21 class MessageInTransit; |
| 24 | 22 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Methods called by |Channel|: | 137 // Methods called by |Channel|: |
| 140 | 138 |
| 141 // Called when the |Channel| takes a reference to this object. This will send | 139 // Called when the |Channel| takes a reference to this object. This will send |
| 142 // all queue messages (in |paused_message_queue_|). | 140 // all queue messages (in |paused_message_queue_|). |
| 143 // TODO(vtl): Maybe rename this "OnAttach"? | 141 // TODO(vtl): Maybe rename this "OnAttach"? |
| 144 void AttachAndRun(Channel* channel, | 142 void AttachAndRun(Channel* channel, |
| 145 ChannelEndpointId local_id, | 143 ChannelEndpointId local_id, |
| 146 ChannelEndpointId remote_id); | 144 ChannelEndpointId remote_id); |
| 147 | 145 |
| 148 // Called when the |Channel| receives a message for the |ChannelEndpoint|. | 146 // Called when the |Channel| receives a message for the |ChannelEndpoint|. |
| 149 bool OnReadMessage(const MessageInTransit::View& message_view, | 147 bool OnReadMessage(scoped_ptr<MessageInTransit> message); |
| 150 embedder::ScopedPlatformHandleVectorPtr platform_handles); | |
| 151 | 148 |
| 152 // Called before the |Channel| gives up its reference to this object. | 149 // Called before the |Channel| gives up its reference to this object. |
| 153 void DetachFromChannel(); | 150 void DetachFromChannel(); |
| 154 | 151 |
| 155 private: | 152 private: |
| 156 friend class base::RefCountedThreadSafe<ChannelEndpoint>; | 153 friend class base::RefCountedThreadSafe<ChannelEndpoint>; |
| 157 ~ChannelEndpoint(); | 154 ~ChannelEndpoint(); |
| 158 | 155 |
| 159 // Must be called with |lock_| held. | 156 // Must be called with |lock_| held. |
| 160 bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message); | 157 bool WriteMessageNoLock(scoped_ptr<MessageInTransit> message); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 185 // messages. | 182 // messages. |
| 186 MessageInTransitQueue paused_message_queue_; | 183 MessageInTransitQueue paused_message_queue_; |
| 187 | 184 |
| 188 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); | 185 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); |
| 189 }; | 186 }; |
| 190 | 187 |
| 191 } // namespace system | 188 } // namespace system |
| 192 } // namespace mojo | 189 } // namespace mojo |
| 193 | 190 |
| 194 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ | 191 #endif // MOJO_EDK_SYSTEM_CHANNEL_ENDPOINT_H_ |
| OLD | NEW |