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

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

Issue 604443002: Mojo: Remove ProxyMessagePipeEndpoint::OnRemove(), etc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@del_pmpe_run-x-del_mp_attach-x-move_paused_message_queue-x-del_pmpe_attach
Patch Set: rebased Created 6 years, 2 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_endpoint.cc ('k') | mojo/system/proxy_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_PROXY_MESSAGE_PIPE_ENDPOINT_H_ 5 #ifndef MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ 6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_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 "mojo/system/message_in_transit.h" 10 #include "mojo/system/message_in_transit.h"
11 #include "mojo/system/message_pipe_endpoint.h" 11 #include "mojo/system/message_pipe_endpoint.h"
12 #include "mojo/system/system_impl_export.h" 12 #include "mojo/system/system_impl_export.h"
13 13
14 namespace mojo { 14 namespace mojo {
15 namespace system { 15 namespace system {
16 16
17 class ChannelEndpoint; 17 class ChannelEndpoint;
18 class LocalMessagePipeEndpoint; 18 class LocalMessagePipeEndpoint;
19 class MessagePipe; 19 class MessagePipe;
20 20
21 // A |ProxyMessagePipeEndpoint| connects an end of a |MessagePipe| to a 21 // A |ProxyMessagePipeEndpoint| is an endpoint which delegates everything to a
22 // |Channel|, over which it transmits and receives data (to/from another 22 // |ChannelEndpoint|, which may be co-owned by a |Channel|. Like any
23 // |ProxyMessagePipeEndpoint|). So a |MessagePipe| with one endpoint local and 23 // |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a
24 // the other endpoint remote consists of a |LocalMessagePipeEndpoint| and a 24 // |MessagePipe|.
25 //
26 // For example, a |MessagePipe| with one endpoint local and the other endpoint
27 // remote consists of a |LocalMessagePipeEndpoint| and a
25 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via 28 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via
26 // a |MessagePipeDispatcher|. 29 // a |MessagePipeDispatcher|.
27 //
28 // Like any |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by a
29 // |MessagePipe|.
30 // - A |ProxyMessagePipeEndpoint| starts out *detached*, i.e., not associated
31 // to any |Channel|. When *attached*, it gets a reference to a |Channel| and
32 // is assigned a local ID. A |ProxyMessagePipeEndpoint| must be detached
33 // before destruction; this is done inside |Close()|.
34 // - When attached, a |ProxyMessagePipeEndpoint| starts out not running. When
35 // run, it gets a remote ID.
36 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint 30 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint
37 : public MessagePipeEndpoint { 31 : public MessagePipeEndpoint {
38 public: 32 public:
39 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint); 33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint);
40 virtual ~ProxyMessagePipeEndpoint(); 34 virtual ~ProxyMessagePipeEndpoint();
41 35
42 // |MessagePipeEndpoint| implementation: 36 // |MessagePipeEndpoint| implementation:
43 virtual Type GetType() const OVERRIDE; 37 virtual Type GetType() const OVERRIDE;
44 virtual bool OnPeerClose() OVERRIDE; 38 virtual bool OnPeerClose() OVERRIDE;
45 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) OVERRIDE; 39 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) OVERRIDE;
46 virtual void OnRemove() OVERRIDE;
47 40
48 private: 41 private:
49 void Detach();
50
51 // TODO(vtl): Get rid of this.
52 bool is_attached() const { return !!channel_endpoint_.get(); }
53
54 // This should only be set if we're attached.
55 scoped_refptr<ChannelEndpoint> channel_endpoint_; 42 scoped_refptr<ChannelEndpoint> channel_endpoint_;
56 43
57 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint); 44 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint);
58 }; 45 };
59 46
60 } // namespace system 47 } // namespace system
61 } // namespace mojo 48 } // namespace mojo
62 49
63 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_ 50 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_endpoint.cc ('k') | mojo/system/proxy_message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698