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

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

Issue 577313002: Mojo: Give ChannelEndpoint the remote ID and ProxyMessagePipeEndpoint the ChannelEndpoint. (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/message_pipe.cc ('k') | mojo/system/message_pipe_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 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; 25 class Channel;
26 class ChannelEndpoint;
26 class Waiter; 27 class Waiter;
27 28
28 // This is an interface to one of the ends of a message pipe, and is used by 29 // This is an interface to one of the ends of a message pipe, and is used by
29 // |MessagePipe|. Its most important role is to provide a sink for messages 30 // |MessagePipe|. Its most important role is to provide a sink for messages
30 // (i.e., a place where messages can be sent). It has a secondary role: When the 31 // (i.e., a place where messages can be sent). It has a secondary role: When the
31 // endpoint is local (i.e., in the current process), there'll be a dispatcher 32 // endpoint is local (i.e., in the current process), there'll be a dispatcher
32 // corresponding to the endpoint. In that case, the implementation of 33 // corresponding to the endpoint. In that case, the implementation of
33 // |MessagePipeEndpoint| also implements the functionality required by the 34 // |MessagePipeEndpoint| also implements the functionality required by the
34 // dispatcher, e.g., to read messages and to wait. Implementations of this class 35 // dispatcher, e.g., to read messages and to wait. Implementations of this class
35 // are not thread-safe; instances are protected by |MesssagePipe|'s lock. 36 // are not thread-safe; instances are protected by |MesssagePipe|'s lock.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual HandleSignalsState GetHandleSignalsState() const; 68 virtual HandleSignalsState GetHandleSignalsState() const;
68 virtual MojoResult AddWaiter(Waiter* waiter, 69 virtual MojoResult AddWaiter(Waiter* waiter,
69 MojoHandleSignals signals, 70 MojoHandleSignals signals,
70 uint32_t context, 71 uint32_t context,
71 HandleSignalsState* signals_state); 72 HandleSignalsState* signals_state);
72 virtual void RemoveWaiter(Waiter* waiter, HandleSignalsState* signals_state); 73 virtual void RemoveWaiter(Waiter* waiter, HandleSignalsState* signals_state);
73 74
74 // Implementations must override these if they represent a proxy endpoint. An 75 // Implementations must override these if they represent a proxy endpoint. An
75 // implementation for a local endpoint needs not override these methods, since 76 // implementation for a local endpoint needs not override these methods, since
76 // they should never be called. 77 // they should never be called.
77 virtual void Attach(scoped_refptr<Channel> channel, 78 virtual void Attach(ChannelEndpoint* channel_endpoint,
79 Channel* channel,
78 MessageInTransit::EndpointId local_id); 80 MessageInTransit::EndpointId local_id);
79 // Returns false if the endpoint should be closed and destroyed, else true. 81 // Returns false if the endpoint should be closed and destroyed, else true.
80 virtual bool Run(MessageInTransit::EndpointId remote_id); 82 virtual bool Run(MessageInTransit::EndpointId remote_id);
81 virtual void OnRemove(); 83 virtual void OnRemove();
82 84
83 protected: 85 protected:
84 MessagePipeEndpoint() {} 86 MessagePipeEndpoint() {}
85 87
86 private: 88 private:
87 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint); 89 DISALLOW_COPY_AND_ASSIGN(MessagePipeEndpoint);
88 }; 90 };
89 91
90 } // namespace system 92 } // namespace system
91 } // namespace mojo 93 } // namespace mojo
92 94
93 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_ 95 #endif // MOJO_SYSTEM_MESSAGE_PIPE_ENDPOINT_H_
OLDNEW
« no previous file with comments | « mojo/system/message_pipe.cc ('k') | mojo/system/message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698