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

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

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
6 #define MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "mojo/edk/system/message_in_transit.h"
11 #include "mojo/edk/system/message_pipe_endpoint.h"
12 #include "mojo/edk/system/system_impl_export.h"
13
14 namespace mojo {
15 namespace system {
16
17 class ChannelEndpoint;
18 class LocalMessagePipeEndpoint;
19 class MessagePipe;
20
21 // A |ProxyMessagePipeEndpoint| is an endpoint which delegates everything to a
22 // |ChannelEndpoint|, which may be co-owned by a |Channel|. Like any
23 // |MessagePipeEndpoint|, a |ProxyMessagePipeEndpoint| is owned by 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
28 // |ProxyMessagePipeEndpoint|, with only the local endpoint being accessible via
29 // a |MessagePipeDispatcher|.
30 class MOJO_SYSTEM_IMPL_EXPORT ProxyMessagePipeEndpoint
31 : public MessagePipeEndpoint {
32 public:
33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint);
34 ~ProxyMessagePipeEndpoint() override;
35
36 // Returns |channel_endpoint_| and resets |channel_endpoint_| to null. This
37 // may be called at most once, after which |Close()| need not be called.
38 //
39 // Note: The returned |ChannelEndpoint| must have its client changed while
40 // still under |MessagePipe|'s lock (which this must have also been called
41 // under).
42 scoped_refptr<ChannelEndpoint> ReleaseChannelEndpoint();
43
44 // |MessagePipeEndpoint| implementation:
45 Type GetType() const override;
46 bool OnPeerClose() override;
47 void EnqueueMessage(scoped_ptr<MessageInTransit> message) override;
48 void Close() override;
49
50 private:
51 void DetachIfNecessary();
52
53 scoped_refptr<ChannelEndpoint> channel_endpoint_;
54
55 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint);
56 };
57
58 } // namespace system
59 } // namespace mojo
60
61 #endif // MOJO_EDK_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/platform_handle_dispatcher_unittest.cc ('k') | mojo/edk/system/proxy_message_pipe_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698