Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(721)

Side by Side Diff: mojo/system/channel_endpoint.h

Issue 580123004: Mojo: Remove knowledge of Channel, etc. from ProxyMessagePipeEndpoint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/system/channel.cc ('k') | mojo/system/channel_endpoint.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SYSTEM_CHANNEL_ENDPOINT_H_ 5 #ifndef MOJO_SYSTEM_CHANNEL_ENDPOINT_H_
6 #define MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ 6 #define MOJO_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/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
11 #include "mojo/system/message_in_transit.h" 12 #include "mojo/system/message_in_transit.h"
12 #include "mojo/system/system_impl_export.h" 13 #include "mojo/system/system_impl_export.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 namespace system { 16 namespace system {
16 17
17 class Channel; 18 class Channel;
18 class MessagePipe; 19 class MessagePipe;
19 20
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 : public base::RefCountedThreadSafe<ChannelEndpoint> { 110 : public base::RefCountedThreadSafe<ChannelEndpoint> {
110 public: 111 public:
111 // TODO(vtl): More comments.... 112 // TODO(vtl): More comments....
112 // The caller must keep |channel| alive until the |Channel| has taken 113 // The caller must keep |channel| alive until the |Channel| has taken
113 // ownership of a reference to the created object. (TODO(vtl): Convert 114 // ownership of a reference to the created object. (TODO(vtl): Convert
114 // |Channel::AttachMessagePipeEndpoint()| to a |Channel::AttachEndpoint()| 115 // |Channel::AttachMessagePipeEndpoint()| to a |Channel::AttachEndpoint()|
115 // that takes a |ChannelEndpoint|, and move |ChannelEndpoint| creation out of 116 // that takes a |ChannelEndpoint|, and move |ChannelEndpoint| creation out of
116 // |Channel|.) 117 // |Channel|.)
117 ChannelEndpoint(MessagePipe* message_pipe, unsigned port); 118 ChannelEndpoint(MessagePipe* message_pipe, unsigned port);
118 119
120 // Methods called by |MessagePipe| (via |ProxyMessagePipeEndpoint|):
121
122 // TODO(vtl): This currently only works if we're "running". We'll move the
123 // "paused message queue" here (will this be needed when we have
124 // locally-allocated remote IDs?).
125 bool EnqueueMessage(scoped_ptr<MessageInTransit> message);
126
127 void DetachFromMessagePipe();
128
129 // Methods called by |Channel|:
130
131 // Called by |Channel| when it takes a reference to this object.
119 void AttachToChannel(Channel* channel, MessageInTransit::EndpointId local_id); 132 void AttachToChannel(Channel* channel, MessageInTransit::EndpointId local_id);
133
134 // TODO(vtl): Combine this with |AttachToChannel()|.
120 void Run(MessageInTransit::EndpointId remote_id); 135 void Run(MessageInTransit::EndpointId remote_id);
121 136
122 // Called by |Channel| before it gives up its reference to this object. 137 // Called by |Channel| before it gives up its reference to this object.
123 void DetachFromChannel(); 138 void DetachFromChannel();
124 139
125 private: 140 private:
126 enum State { 141 enum State {
127 // Attached, possibly running or not. 142 // Attached, possibly running or not.
128 STATE_NORMAL, 143 STATE_NORMAL,
129 // "Zombie" states: 144 // "Zombie" states:
(...skipping 26 matching lines...) Expand all
156 MessageInTransit::EndpointId local_id_; 171 MessageInTransit::EndpointId local_id_;
157 MessageInTransit::EndpointId remote_id_; 172 MessageInTransit::EndpointId remote_id_;
158 173
159 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint); 174 DISALLOW_COPY_AND_ASSIGN(ChannelEndpoint);
160 }; 175 };
161 176
162 } // namespace system 177 } // namespace system
163 } // namespace mojo 178 } // namespace mojo
164 179
165 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_ 180 #endif // MOJO_SYSTEM_CHANNEL_ENDPOINT_H_
OLDNEW
« no previous file with comments | « mojo/system/channel.cc ('k') | mojo/system/channel_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698