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

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

Issue 304233005: Mojo: Implement passing of shared buffers across processes on POSIX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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 | « no previous file | mojo/system/raw_shared_buffer.h » ('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/dispatcher.h" 5 #include "mojo/system/dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/system/constants.h" 8 #include "mojo/system/constants.h"
9 #include "mojo/system/message_pipe_dispatcher.h" 9 #include "mojo/system/message_pipe_dispatcher.h"
10 #include "mojo/system/platform_handle_dispatcher.h" 10 #include "mojo/system/platform_handle_dispatcher.h"
11 #include "mojo/system/shared_buffer_dispatcher.h"
11 12
12 namespace mojo { 13 namespace mojo {
13 namespace system { 14 namespace system {
14 15
15 namespace test { 16 namespace test {
16 17
17 // TODO(vtl): Maybe this should be defined in a test-only file instead. 18 // TODO(vtl): Maybe this should be defined in a test-only file instead.
18 DispatcherTransport DispatcherTryStartTransport( 19 DispatcherTransport DispatcherTryStartTransport(
19 Dispatcher* dispatcher) { 20 Dispatcher* dispatcher) {
20 return Dispatcher::HandleTableAccess::TryStartTransport(dispatcher); 21 return Dispatcher::HandleTableAccess::TryStartTransport(dispatcher);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 embedder::PlatformHandleVector* platform_handles) { 72 embedder::PlatformHandleVector* platform_handles) {
72 switch (static_cast<int32_t>(type)) { 73 switch (static_cast<int32_t>(type)) {
73 case kTypeUnknown: 74 case kTypeUnknown:
74 DVLOG(2) << "Deserializing invalid handle"; 75 DVLOG(2) << "Deserializing invalid handle";
75 return scoped_refptr<Dispatcher>(); 76 return scoped_refptr<Dispatcher>();
76 case kTypeMessagePipe: 77 case kTypeMessagePipe:
77 return scoped_refptr<Dispatcher>( 78 return scoped_refptr<Dispatcher>(
78 MessagePipeDispatcher::Deserialize(channel, source, size)); 79 MessagePipeDispatcher::Deserialize(channel, source, size));
79 case kTypeDataPipeProducer: 80 case kTypeDataPipeProducer:
80 case kTypeDataPipeConsumer: 81 case kTypeDataPipeConsumer:
81 case kTypeSharedBuffer:
82 // TODO(vtl): Implement. 82 // TODO(vtl): Implement.
83 LOG(WARNING) << "Deserialization of dispatcher type " << type 83 LOG(WARNING) << "Deserialization of dispatcher type " << type
84 << " not supported"; 84 << " not supported";
85 return scoped_refptr<Dispatcher>(); 85 return scoped_refptr<Dispatcher>();
86 case kTypeSharedBuffer:
87 return scoped_refptr<Dispatcher>(
88 SharedBufferDispatcher::Deserialize(channel, source, size,
89 platform_handles));
86 case kTypePlatformHandle: 90 case kTypePlatformHandle:
87 return scoped_refptr<Dispatcher>( 91 return scoped_refptr<Dispatcher>(
88 PlatformHandleDispatcher::Deserialize(channel, source, size, 92 PlatformHandleDispatcher::Deserialize(channel, source, size,
89 platform_handles)); 93 platform_handles));
90 } 94 }
91 LOG(WARNING) << "Unknown dispatcher type " << type; 95 LOG(WARNING) << "Unknown dispatcher type " << type;
92 return scoped_refptr<Dispatcher>(); 96 return scoped_refptr<Dispatcher>();
93 } 97 }
94 98
95 MojoResult Dispatcher::Close() { 99 MojoResult Dispatcher::Close() {
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // DispatcherTransport --------------------------------------------------------- 454 // DispatcherTransport ---------------------------------------------------------
451 455
452 void DispatcherTransport::End() { 456 void DispatcherTransport::End() {
453 DCHECK(dispatcher_); 457 DCHECK(dispatcher_);
454 dispatcher_->lock_.Release(); 458 dispatcher_->lock_.Release();
455 dispatcher_ = NULL; 459 dispatcher_ = NULL;
456 } 460 }
457 461
458 } // namespace system 462 } // namespace system
459 } // namespace mojo 463 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/raw_shared_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698