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

Side by Side Diff: mojo/system/message_pipe.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_endpoint.cc ('k') | mojo/system/message_pipe.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 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_H_ 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_H_ 6 #define MOJO_SYSTEM_MESSAGE_PIPE_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 "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "mojo/public/c/system/message_pipe.h" 16 #include "mojo/public/c/system/message_pipe.h"
17 #include "mojo/public/c/system/types.h" 17 #include "mojo/public/c/system/types.h"
18 #include "mojo/system/dispatcher.h" 18 #include "mojo/system/dispatcher.h"
19 #include "mojo/system/handle_signals_state.h" 19 #include "mojo/system/handle_signals_state.h"
20 #include "mojo/system/memory.h" 20 #include "mojo/system/memory.h"
21 #include "mojo/system/message_in_transit.h" 21 #include "mojo/system/message_in_transit.h"
22 #include "mojo/system/message_pipe_endpoint.h" 22 #include "mojo/system/message_pipe_endpoint.h"
23 #include "mojo/system/system_impl_export.h" 23 #include "mojo/system/system_impl_export.h"
24 24
25 namespace mojo { 25 namespace mojo {
26 namespace system { 26 namespace system {
27 27
28 class Channel;
29 class ChannelEndpoint; 28 class ChannelEndpoint;
30 class Waiter; 29 class Waiter;
31 30
32 // |MessagePipe| is the secondary object implementing a message pipe (see the 31 // |MessagePipe| is the secondary object implementing a message pipe (see the
33 // explanatory comment in core.cc). It is typically owned by the dispatcher(s) 32 // explanatory comment in core.cc). It is typically owned by the dispatcher(s)
34 // corresponding to the local endpoints. This class is thread-safe. 33 // corresponding to the local endpoints. This class is thread-safe.
35 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe 34 class MOJO_SYSTEM_IMPL_EXPORT MessagePipe
36 : public base::RefCountedThreadSafe<MessagePipe> { 35 : public base::RefCountedThreadSafe<MessagePipe> {
37 public: 36 public:
38 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint0, 37 MessagePipe(scoped_ptr<MessagePipeEndpoint> endpoint0,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // endpoint. 88 // endpoint.
90 void ConvertLocalToProxy(unsigned port); 89 void ConvertLocalToProxy(unsigned port);
91 90
92 // This is used by |Channel| to enqueue messages (typically to a 91 // This is used by |Channel| to enqueue messages (typically to a
93 // |LocalMessagePipeEndpoint|). Unlike |WriteMessage()|, |port| is the 92 // |LocalMessagePipeEndpoint|). Unlike |WriteMessage()|, |port| is the
94 // *destination* port. 93 // *destination* port.
95 MojoResult EnqueueMessage(unsigned port, 94 MojoResult EnqueueMessage(unsigned port,
96 scoped_ptr<MessageInTransit> message); 95 scoped_ptr<MessageInTransit> message);
97 96
98 // These are used by |Channel|. 97 // These are used by |Channel|.
99 bool Attach(unsigned port, 98 bool Attach(unsigned port, ChannelEndpoint* channel_endpoint);
100 ChannelEndpoint* channel_endpoint, 99 void Run(unsigned port);
101 Channel* channel,
102 MessageInTransit::EndpointId local_id);
103 void Run(unsigned port, MessageInTransit::EndpointId remote_id);
104 void OnRemove(unsigned port); 100 void OnRemove(unsigned port);
105 101
106 private: 102 private:
107 friend class base::RefCountedThreadSafe<MessagePipe>; 103 friend class base::RefCountedThreadSafe<MessagePipe>;
108 virtual ~MessagePipe(); 104 virtual ~MessagePipe();
109 105
110 // This is used internally by |WriteMessage()| and by |EnqueueMessage()|. 106 // This is used internally by |WriteMessage()| and by |EnqueueMessage()|.
111 // |transports| may be non-null only if it's nonempty and |message| has no 107 // |transports| may be non-null only if it's nonempty and |message| has no
112 // dispatchers attached. 108 // dispatchers attached.
113 MojoResult EnqueueMessageInternal( 109 MojoResult EnqueueMessageInternal(
(...skipping 15 matching lines...) Expand all
129 base::Lock lock_; // Protects the following members. 125 base::Lock lock_; // Protects the following members.
130 scoped_ptr<MessagePipeEndpoint> endpoints_[2]; 126 scoped_ptr<MessagePipeEndpoint> endpoints_[2];
131 127
132 DISALLOW_COPY_AND_ASSIGN(MessagePipe); 128 DISALLOW_COPY_AND_ASSIGN(MessagePipe);
133 }; 129 };
134 130
135 } // namespace system 131 } // namespace system
136 } // namespace mojo 132 } // namespace mojo
137 133
138 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_ 134 #endif // MOJO_SYSTEM_MESSAGE_PIPE_H_
OLDNEW
« no previous file with comments | « mojo/system/channel_endpoint.cc ('k') | mojo/system/message_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698