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

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

Issue 1396783004: Convert mojo::system::ChannelEndpointClient to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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/edk/system/message_pipe.cc ('k') | mojo/edk/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_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 6 #define MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "mojo/edk/system/dispatcher.h" 9 #include "mojo/edk/system/dispatcher.h"
10 #include "mojo/edk/system/memory.h" 10 #include "mojo/edk/system/memory.h"
(...skipping 24 matching lines...) Expand all
35 // Validates and/or sets default options for |MojoCreateMessagePipeOptions|. 35 // Validates and/or sets default options for |MojoCreateMessagePipeOptions|.
36 // If non-null, |in_options| must point to a struct of at least 36 // If non-null, |in_options| must point to a struct of at least
37 // |in_options->struct_size| bytes. |out_options| must point to a (current) 37 // |in_options->struct_size| bytes. |out_options| must point to a (current)
38 // |MojoCreateMessagePipeOptions| and will be entirely overwritten on success 38 // |MojoCreateMessagePipeOptions| and will be entirely overwritten on success
39 // (it may be partly overwritten on failure). 39 // (it may be partly overwritten on failure).
40 static MojoResult ValidateCreateOptions( 40 static MojoResult ValidateCreateOptions(
41 UserPointer<const MojoCreateMessagePipeOptions> in_options, 41 UserPointer<const MojoCreateMessagePipeOptions> in_options,
42 MojoCreateMessagePipeOptions* out_options); 42 MojoCreateMessagePipeOptions* out_options);
43 43
44 // Must be called before any other methods. (This method is not thread-safe.) 44 // Must be called before any other methods. (This method is not thread-safe.)
45 void Init(scoped_refptr<MessagePipe> message_pipe, 45 void Init(RefPtr<MessagePipe>&& message_pipe,
46 unsigned port) MOJO_NOT_THREAD_SAFE; 46 unsigned port) MOJO_NOT_THREAD_SAFE;
47 47
48 // |Dispatcher| public methods: 48 // |Dispatcher| public methods:
49 Type GetType() const override; 49 Type GetType() const override;
50 50
51 // Creates a |MessagePipe| with a local endpoint (at port 0) and a proxy 51 // Creates a |MessagePipe| with a local endpoint (at port 0) and a proxy
52 // endpoint, and creates/initializes a |MessagePipeDispatcher| (attached to 52 // endpoint, and creates/initializes a |MessagePipeDispatcher| (attached to
53 // the message pipe, port 0). 53 // the message pipe, port 0).
54 // TODO(vtl): This currently uses |kDefaultCreateOptions|, which is okay since 54 // TODO(vtl): This currently uses |kDefaultCreateOptions|, which is okay since
55 // there aren't any options, but eventually options should be plumbed through. 55 // there aren't any options, but eventually options should be plumbed through.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 size_t* max_platform_handles) override 103 size_t* max_platform_handles) override
104 MOJO_NOT_THREAD_SAFE; 104 MOJO_NOT_THREAD_SAFE;
105 bool EndSerializeAndCloseImplNoLock( 105 bool EndSerializeAndCloseImplNoLock(
106 Channel* channel, 106 Channel* channel,
107 void* destination, 107 void* destination,
108 size_t* actual_size, 108 size_t* actual_size,
109 embedder::PlatformHandleVector* platform_handles) override 109 embedder::PlatformHandleVector* platform_handles) override
110 MOJO_NOT_THREAD_SAFE; 110 MOJO_NOT_THREAD_SAFE;
111 111
112 // This will be null if closed. 112 // This will be null if closed.
113 scoped_refptr<MessagePipe> message_pipe_ MOJO_GUARDED_BY(mutex()); 113 RefPtr<MessagePipe> message_pipe_ MOJO_GUARDED_BY(mutex());
114 unsigned port_ MOJO_GUARDED_BY(mutex()); 114 unsigned port_ MOJO_GUARDED_BY(mutex());
115 115
116 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher); 116 MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher);
117 }; 117 };
118 118
119 class MessagePipeDispatcherTransport : public DispatcherTransport { 119 class MessagePipeDispatcherTransport : public DispatcherTransport {
120 public: 120 public:
121 explicit MessagePipeDispatcherTransport(DispatcherTransport transport); 121 explicit MessagePipeDispatcherTransport(DispatcherTransport transport);
122 122
123 MessagePipe* GetMessagePipe() { 123 MessagePipe* GetMessagePipe() {
124 return message_pipe_dispatcher()->GetMessagePipeNoLock(); 124 return message_pipe_dispatcher()->GetMessagePipeNoLock();
125 } 125 }
126 unsigned GetPort() { return message_pipe_dispatcher()->GetPortNoLock(); } 126 unsigned GetPort() { return message_pipe_dispatcher()->GetPortNoLock(); }
127 127
128 private: 128 private:
129 MessagePipeDispatcher* message_pipe_dispatcher() { 129 MessagePipeDispatcher* message_pipe_dispatcher() {
130 return static_cast<MessagePipeDispatcher*>(dispatcher()); 130 return static_cast<MessagePipeDispatcher*>(dispatcher());
131 } 131 }
132 132
133 // Copy and assign allowed. 133 // Copy and assign allowed.
134 }; 134 };
135 135
136 } // namespace system 136 } // namespace system
137 } // namespace mojo 137 } // namespace mojo
138 138
139 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_ 139 #endif // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe.cc ('k') | mojo/edk/system/message_pipe_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698