| OLD | NEW |
| 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/edk/system/dispatcher.h" | 5 #include "mojo/edk/system/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/edk/system/configuration.h" | 8 #include "mojo/edk/system/configuration.h" |
| 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
| 9 #include "mojo/edk/system/message_pipe_dispatcher.h" | 11 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 10 #include "mojo/edk/system/platform_handle_dispatcher.h" | 12 #include "mojo/edk/system/platform_handle_dispatcher.h" |
| 11 #include "mojo/edk/system/shared_buffer_dispatcher.h" | 13 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 12 | 14 |
| 13 namespace mojo { | 15 namespace mojo { |
| 14 namespace system { | 16 namespace system { |
| 15 | 17 |
| 16 namespace test { | 18 namespace test { |
| 17 | 19 |
| 18 // TODO(vtl): Maybe this should be defined in a test-only file instead. | 20 // TODO(vtl): Maybe this should be defined in a test-only file instead. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 size_t size, | 72 size_t size, |
| 71 embedder::PlatformHandleVector* platform_handles) { | 73 embedder::PlatformHandleVector* platform_handles) { |
| 72 switch (static_cast<int32_t>(type)) { | 74 switch (static_cast<int32_t>(type)) { |
| 73 case kTypeUnknown: | 75 case kTypeUnknown: |
| 74 DVLOG(2) << "Deserializing invalid handle"; | 76 DVLOG(2) << "Deserializing invalid handle"; |
| 75 return nullptr; | 77 return nullptr; |
| 76 case kTypeMessagePipe: | 78 case kTypeMessagePipe: |
| 77 return scoped_refptr<Dispatcher>( | 79 return scoped_refptr<Dispatcher>( |
| 78 MessagePipeDispatcher::Deserialize(channel, source, size)); | 80 MessagePipeDispatcher::Deserialize(channel, source, size)); |
| 79 case kTypeDataPipeProducer: | 81 case kTypeDataPipeProducer: |
| 82 return scoped_refptr<Dispatcher>( |
| 83 DataPipeProducerDispatcher::Deserialize(channel, source, size)); |
| 80 case kTypeDataPipeConsumer: | 84 case kTypeDataPipeConsumer: |
| 81 // TODO(vtl): Implement. | 85 return scoped_refptr<Dispatcher>( |
| 82 LOG(WARNING) << "Deserialization of dispatcher type " << type | 86 DataPipeConsumerDispatcher::Deserialize(channel, source, size)); |
| 83 << " not supported"; | |
| 84 return nullptr; | |
| 85 case kTypeSharedBuffer: | 87 case kTypeSharedBuffer: |
| 86 return scoped_refptr<Dispatcher>(SharedBufferDispatcher::Deserialize( | 88 return scoped_refptr<Dispatcher>(SharedBufferDispatcher::Deserialize( |
| 87 channel, source, size, platform_handles)); | 89 channel, source, size, platform_handles)); |
| 88 case kTypePlatformHandle: | 90 case kTypePlatformHandle: |
| 89 return scoped_refptr<Dispatcher>(PlatformHandleDispatcher::Deserialize( | 91 return scoped_refptr<Dispatcher>(PlatformHandleDispatcher::Deserialize( |
| 90 channel, source, size, platform_handles)); | 92 channel, source, size, platform_handles)); |
| 91 } | 93 } |
| 92 LOG(WARNING) << "Unknown dispatcher type " << type; | 94 LOG(WARNING) << "Unknown dispatcher type " << type; |
| 93 return nullptr; | 95 return nullptr; |
| 94 } | 96 } |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 // DispatcherTransport --------------------------------------------------------- | 485 // DispatcherTransport --------------------------------------------------------- |
| 484 | 486 |
| 485 void DispatcherTransport::End() { | 487 void DispatcherTransport::End() { |
| 486 DCHECK(dispatcher_); | 488 DCHECK(dispatcher_); |
| 487 dispatcher_->lock_.Release(); | 489 dispatcher_->lock_.Release(); |
| 488 dispatcher_ = nullptr; | 490 dispatcher_ = nullptr; |
| 489 } | 491 } |
| 490 | 492 |
| 491 } // namespace system | 493 } // namespace system |
| 492 } // namespace mojo | 494 } // namespace mojo |
| OLD | NEW |