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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/edk/system/data_pipe.h" | 8 #include "mojo/edk/system/data_pipe.h" |
9 #include "mojo/edk/system/memory.h" | 9 #include "mojo/edk/system/memory.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 namespace system { | 12 namespace system { |
13 | 13 |
14 DataPipeConsumerDispatcher::DataPipeConsumerDispatcher() { | 14 DataPipeConsumerDispatcher::DataPipeConsumerDispatcher() { |
15 } | 15 } |
16 | 16 |
17 void DataPipeConsumerDispatcher::Init(scoped_refptr<DataPipe> data_pipe) { | 17 void DataPipeConsumerDispatcher::Init(scoped_refptr<DataPipe> data_pipe) { |
18 DCHECK(data_pipe); | 18 DCHECK(data_pipe); |
19 data_pipe_ = data_pipe; | 19 data_pipe_ = data_pipe; |
20 } | 20 } |
21 | 21 |
22 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { | 22 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { |
23 return kTypeDataPipeConsumer; | 23 return Type::DATA_PIPE_CONSUMER; |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 scoped_refptr<DataPipeConsumerDispatcher> | 27 scoped_refptr<DataPipeConsumerDispatcher> |
28 DataPipeConsumerDispatcher::Deserialize(Channel* channel, | 28 DataPipeConsumerDispatcher::Deserialize(Channel* channel, |
29 const void* source, | 29 const void* source, |
30 size_t size) { | 30 size_t size) { |
31 scoped_refptr<DataPipe> data_pipe; | 31 scoped_refptr<DataPipe> data_pipe; |
32 if (!DataPipe::ConsumerDeserialize(channel, source, size, &data_pipe)) | 32 if (!DataPipe::ConsumerDeserialize(channel, source, size, &data_pipe)) |
33 return nullptr; | 33 return nullptr; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return rv; | 163 return rv; |
164 } | 164 } |
165 | 165 |
166 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 166 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
167 lock().AssertAcquired(); | 167 lock().AssertAcquired(); |
168 return data_pipe_->ConsumerIsBusy(); | 168 return data_pipe_->ConsumerIsBusy(); |
169 } | 169 } |
170 | 170 |
171 } // namespace system | 171 } // namespace system |
172 } // namespace mojo | 172 } // namespace mojo |
OLD | NEW |