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.
5 #ifndef MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
6 #define MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "mojo/system/message_in_transit.h"
11 #include "mojo/system/message_pipe_endpoint.h"
12 #include "mojo/system/system_impl_export.h"
17 class ChannelEndpoint;
18 class LocalMessagePipeEndpoint;
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
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 {
33 explicit ProxyMessagePipeEndpoint(ChannelEndpoint* channel_endpoint);
34 virtual ~ProxyMessagePipeEndpoint();
36 // |MessagePipeEndpoint| implementation:
37 virtual Type GetType() const OVERRIDE;
38 virtual bool OnPeerClose() OVERRIDE;
39 virtual void EnqueueMessage(scoped_ptr<MessageInTransit> message) OVERRIDE;
42 scoped_refptr<ChannelEndpoint> channel_endpoint_;
44 DISALLOW_COPY_AND_ASSIGN(ProxyMessagePipeEndpoint);
50 #endif // MOJO_SYSTEM_PROXY_MESSAGE_PIPE_ENDPOINT_H_