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

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

Issue 588193004: Mojo: Have |ProxyMessagePipeEndpoint|s constructed with a |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_dispatcher.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_DISPATCHER_H_ 5 #ifndef MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
6 #define MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 6 #define MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
7 7
8 #include <utility>
9
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
12 #include "mojo/system/dispatcher.h" 10 #include "mojo/system/dispatcher.h"
13 #include "mojo/system/memory.h" 11 #include "mojo/system/memory.h"
14 #include "mojo/system/system_impl_export.h" 12 #include "mojo/system/system_impl_export.h"
15 13
16 namespace mojo { 14 namespace mojo {
17 namespace system { 15 namespace system {
18 16
17 class ChannelEndpoint;
19 class MessagePipe; 18 class MessagePipe;
20 class MessagePipeDispatcherTransport; 19 class MessagePipeDispatcherTransport;
21 20
22 // This is the |Dispatcher| implementation for message pipes (created by the 21 // This is the |Dispatcher| implementation for message pipes (created by the
23 // Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe. 22 // Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe.
24 class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher : public Dispatcher { 23 class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher : public Dispatcher {
25 public: 24 public:
26 // The default options to use for |MojoCreateMessagePipe()|. (Real uses 25 // The default options to use for |MojoCreateMessagePipe()|. (Real uses
27 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; 26 // should obtain this via |ValidateCreateOptions()| with a null |in_options|;
28 // this is exposed directly for testing convenience.) 27 // this is exposed directly for testing convenience.)
(...skipping 15 matching lines...) Expand all
44 void Init(scoped_refptr<MessagePipe> message_pipe, unsigned port); 43 void Init(scoped_refptr<MessagePipe> message_pipe, unsigned port);
45 44
46 // |Dispatcher| public methods: 45 // |Dispatcher| public methods:
47 virtual Type GetType() const OVERRIDE; 46 virtual Type GetType() const OVERRIDE;
48 47
49 // Creates a |MessagePipe| with a local endpoint (at port 0) and a proxy 48 // Creates a |MessagePipe| with a local endpoint (at port 0) and a proxy
50 // endpoint, and creates/initializes a |MessagePipeDispatcher| (attached to 49 // endpoint, and creates/initializes a |MessagePipeDispatcher| (attached to
51 // the message pipe, port 0). 50 // the message pipe, port 0).
52 // TODO(vtl): This currently uses |kDefaultCreateOptions|, which is okay since 51 // TODO(vtl): This currently uses |kDefaultCreateOptions|, which is okay since
53 // there aren't any options, but eventually options should be plumbed through. 52 // there aren't any options, but eventually options should be plumbed through.
54 static std::pair<scoped_refptr<MessagePipeDispatcher>, 53 static scoped_refptr<MessagePipeDispatcher> CreateRemoteMessagePipe(
55 scoped_refptr<MessagePipe> > 54 scoped_refptr<ChannelEndpoint>* channel_endpoint);
56 CreateRemoteMessagePipe();
57 55
58 // The "opposite" of |SerializeAndClose()|. (Typically this is called by 56 // The "opposite" of |SerializeAndClose()|. (Typically this is called by
59 // |Dispatcher::Deserialize()|.) 57 // |Dispatcher::Deserialize()|.)
60 static scoped_refptr<MessagePipeDispatcher> Deserialize(Channel* channel, 58 static scoped_refptr<MessagePipeDispatcher> Deserialize(Channel* channel,
61 const void* source, 59 const void* source,
62 size_t size); 60 size_t size);
63 61
64 private: 62 private:
65 friend class MessagePipeDispatcherTransport; 63 friend class MessagePipeDispatcherTransport;
66 64
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return static_cast<MessagePipeDispatcher*>(dispatcher()); 126 return static_cast<MessagePipeDispatcher*>(dispatcher());
129 } 127 }
130 128
131 // Copy and assign allowed. 129 // Copy and assign allowed.
132 }; 130 };
133 131
134 } // namespace system 132 } // namespace system
135 } // namespace mojo 133 } // namespace mojo
136 134
137 #endif // MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 135 #endif // MOJO_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « mojo/system/message_pipe.cc ('k') | mojo/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698