| 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/data_pipe_consumer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/edk/system/data_pipe.h" | 10 #include "mojo/edk/system/data_pipe.h" |
| 11 #include "mojo/edk/system/memory.h" | 11 #include "mojo/edk/system/memory.h" |
| 12 #include "mojo/edk/system/options_validation.h" | 12 #include "mojo/edk/system/options_validation.h" |
| 13 | 13 |
| 14 using mojo::platform::ScopedPlatformHandle; | 14 using mojo::platform::ScopedPlatformHandle; |
| 15 using mojo::util::MutexLocker; | 15 using mojo::util::MutexLocker; |
| 16 using mojo::util::RefPtr; | 16 using mojo::util::RefPtr; |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 namespace system { | 19 namespace system { |
| 20 | 20 |
| 21 void DataPipeConsumerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) { | 21 void DataPipeConsumerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) { |
| 22 DCHECK(data_pipe); | 22 DCHECK(data_pipe); |
| 23 data_pipe_ = std::move(data_pipe); | 23 data_pipe_ = std::move(data_pipe); |
| 24 } | 24 } |
| 25 | 25 |
| 26 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { | 26 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { |
| 27 return Type::DATA_PIPE_CONSUMER; | 27 return Type::DATA_PIPE_CONSUMER; |
| 28 } | 28 } |
| 29 | 29 |
| 30 bool DataPipeConsumerDispatcher::SupportsEntrypointClass( |
| 31 EntrypointClass entrypoint_class) const { |
| 32 return (entrypoint_class == EntrypointClass::DATA_PIPE_CONSUMER); |
| 33 } |
| 34 |
| 30 // static | 35 // static |
| 31 RefPtr<DataPipeConsumerDispatcher> DataPipeConsumerDispatcher::Deserialize( | 36 RefPtr<DataPipeConsumerDispatcher> DataPipeConsumerDispatcher::Deserialize( |
| 32 Channel* channel, | 37 Channel* channel, |
| 33 const void* source, | 38 const void* source, |
| 34 size_t size) { | 39 size_t size) { |
| 35 RefPtr<DataPipe> data_pipe; | 40 RefPtr<DataPipe> data_pipe; |
| 36 if (!DataPipe::ConsumerDeserialize(channel, source, size, &data_pipe)) | 41 if (!DataPipe::ConsumerDeserialize(channel, source, size, &data_pipe)) |
| 37 return nullptr; | 42 return nullptr; |
| 38 DCHECK(data_pipe); | 43 DCHECK(data_pipe); |
| 39 | 44 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return rv; | 222 return rv; |
| 218 } | 223 } |
| 219 | 224 |
| 220 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 225 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
| 221 mutex().AssertHeld(); | 226 mutex().AssertHeld(); |
| 222 return data_pipe_->ConsumerIsBusy(); | 227 return data_pipe_->ConsumerIsBusy(); |
| 223 } | 228 } |
| 224 | 229 |
| 225 } // namespace system | 230 } // namespace system |
| 226 } // namespace mojo | 231 } // namespace mojo |
| OLD | NEW |