| 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 | 12 |
| 13 using mojo::embedder::ScopedPlatformHandle; |
| 13 using mojo::util::MutexLocker; | 14 using mojo::util::MutexLocker; |
| 14 using mojo::util::RefPtr; | 15 using mojo::util::RefPtr; |
| 15 | 16 |
| 16 namespace mojo { | 17 namespace mojo { |
| 17 namespace system { | 18 namespace system { |
| 18 | 19 |
| 19 void DataPipeConsumerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) { | 20 void DataPipeConsumerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) { |
| 20 DCHECK(data_pipe); | 21 DCHECK(data_pipe); |
| 21 data_pipe_ = std::move(data_pipe); | 22 data_pipe_ = std::move(data_pipe); |
| 22 } | 23 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 size_t* max_size, | 155 size_t* max_size, |
| 155 size_t* max_platform_handles) { | 156 size_t* max_platform_handles) { |
| 156 AssertHasOneRef(); // Only one ref => no need to take the lock. | 157 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 157 data_pipe_->ConsumerStartSerialize(channel, max_size, max_platform_handles); | 158 data_pipe_->ConsumerStartSerialize(channel, max_size, max_platform_handles); |
| 158 } | 159 } |
| 159 | 160 |
| 160 bool DataPipeConsumerDispatcher::EndSerializeAndCloseImplNoLock( | 161 bool DataPipeConsumerDispatcher::EndSerializeAndCloseImplNoLock( |
| 161 Channel* channel, | 162 Channel* channel, |
| 162 void* destination, | 163 void* destination, |
| 163 size_t* actual_size, | 164 size_t* actual_size, |
| 164 embedder::PlatformHandleVector* platform_handles) { | 165 std::vector<ScopedPlatformHandle>* platform_handles) { |
| 165 AssertHasOneRef(); // Only one ref => no need to take the lock. | 166 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 166 | 167 |
| 167 bool rv = data_pipe_->ConsumerEndSerialize(channel, destination, actual_size, | 168 bool rv = data_pipe_->ConsumerEndSerialize(channel, destination, actual_size, |
| 168 platform_handles); | 169 platform_handles); |
| 169 data_pipe_ = nullptr; | 170 data_pipe_ = nullptr; |
| 170 return rv; | 171 return rv; |
| 171 } | 172 } |
| 172 | 173 |
| 173 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 174 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
| 174 mutex().AssertHeld(); | 175 mutex().AssertHeld(); |
| 175 return data_pipe_->ConsumerIsBusy(); | 176 return data_pipe_->ConsumerIsBusy(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 } // namespace system | 179 } // namespace system |
| 179 } // namespace mojo | 180 } // namespace mojo |
| OLD | NEW |