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

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

Issue 227383006: Mojo: Allow dispatchers to attach PlatformHandles to the MessageInTransit on serialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/shared_buffer_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 #include "mojo/system/message_pipe_dispatcher.h" 5 #include "mojo/system/message_pipe_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/channel.h" 8 #include "mojo/system/channel.h"
9 #include "mojo/system/constants.h" 9 #include "mojo/system/constants.h"
10 #include "mojo/system/local_message_pipe_endpoint.h" 10 #include "mojo/system/local_message_pipe_endpoint.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 MojoResult wake_result) { 165 MojoResult wake_result) {
166 lock().AssertAcquired(); 166 lock().AssertAcquired();
167 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result); 167 return message_pipe_->AddWaiter(port_, waiter, flags, wake_result);
168 } 168 }
169 169
170 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { 170 void MessagePipeDispatcher::RemoveWaiterImplNoLock(Waiter* waiter) {
171 lock().AssertAcquired(); 171 lock().AssertAcquired();
172 message_pipe_->RemoveWaiter(port_, waiter); 172 message_pipe_->RemoveWaiter(port_, waiter);
173 } 173 }
174 174
175 size_t MessagePipeDispatcher::GetMaximumSerializedSizeImplNoLock( 175 void MessagePipeDispatcher::StartSerializeImplNoLock(
176 const Channel* /*channel*/) const { 176 Channel* /*channel*/,
177 size_t* max_size,
178 size_t* max_platform_handles) {
177 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. 179 DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
178 return sizeof(SerializedMessagePipeDispatcher); 180 *max_size = sizeof(SerializedMessagePipeDispatcher);
181 *max_platform_handles = 0;
179 } 182 }
180 183
181 bool MessagePipeDispatcher::SerializeAndCloseImplNoLock(Channel* channel, 184 bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock(
182 void* destination, 185 Channel* channel,
183 size_t* actual_size) { 186 void* destination,
187 size_t* actual_size,
188 std::vector<embedder::PlatformHandle>* platform_handles) {
184 DCHECK(HasOneRef()); // Only one ref => no need to take the lock. 189 DCHECK(HasOneRef()); // Only one ref => no need to take the lock.
185 190
186 // Convert the local endpoint to a proxy endpoint (moving the message queue). 191 // Convert the local endpoint to a proxy endpoint (moving the message queue).
187 message_pipe_->ConvertLocalToProxy(port_); 192 message_pipe_->ConvertLocalToProxy(port_);
188 193
189 // Attach the new proxy endpoint to the channel. 194 // Attach the new proxy endpoint to the channel.
190 MessageInTransit::EndpointId endpoint_id = 195 MessageInTransit::EndpointId endpoint_id =
191 channel->AttachMessagePipeEndpoint(message_pipe_, port_); 196 channel->AttachMessagePipeEndpoint(message_pipe_, port_);
192 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId); 197 DCHECK_NE(endpoint_id, MessageInTransit::kInvalidEndpointId);
193 198
(...skipping 14 matching lines...) Expand all
208 213
209 // MessagePipeDispatcherTransport ---------------------------------------------- 214 // MessagePipeDispatcherTransport ----------------------------------------------
210 215
211 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( 216 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport(
212 DispatcherTransport transport) : DispatcherTransport(transport) { 217 DispatcherTransport transport) : DispatcherTransport(transport) {
213 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); 218 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe);
214 } 219 }
215 220
216 } // namespace system 221 } // namespace system
217 } // namespace mojo 222 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/system/message_pipe_dispatcher.h ('k') | mojo/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698