| 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_producer_dispatcher.h" | 5 #include "mojo/edk/system/data_pipe_producer_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 DataPipeProducerDispatcher::Init(RefPtr<DataPipe>&& data_pipe) { | 20 void DataPipeProducerDispatcher::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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 size_t* max_size, | 131 size_t* max_size, |
| 131 size_t* max_platform_handles) { | 132 size_t* max_platform_handles) { |
| 132 AssertHasOneRef(); // Only one ref => no need to take the lock. | 133 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 133 data_pipe_->ProducerStartSerialize(channel, max_size, max_platform_handles); | 134 data_pipe_->ProducerStartSerialize(channel, max_size, max_platform_handles); |
| 134 } | 135 } |
| 135 | 136 |
| 136 bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock( | 137 bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock( |
| 137 Channel* channel, | 138 Channel* channel, |
| 138 void* destination, | 139 void* destination, |
| 139 size_t* actual_size, | 140 size_t* actual_size, |
| 140 embedder::PlatformHandleVector* platform_handles) { | 141 std::vector<ScopedPlatformHandle>* platform_handles) { |
| 141 AssertHasOneRef(); // Only one ref => no need to take the lock. | 142 AssertHasOneRef(); // Only one ref => no need to take the lock. |
| 142 | 143 |
| 143 bool rv = data_pipe_->ProducerEndSerialize(channel, destination, actual_size, | 144 bool rv = data_pipe_->ProducerEndSerialize(channel, destination, actual_size, |
| 144 platform_handles); | 145 platform_handles); |
| 145 data_pipe_ = nullptr; | 146 data_pipe_ = nullptr; |
| 146 return rv; | 147 return rv; |
| 147 } | 148 } |
| 148 | 149 |
| 149 bool DataPipeProducerDispatcher::IsBusyNoLock() const { | 150 bool DataPipeProducerDispatcher::IsBusyNoLock() const { |
| 150 mutex().AssertHeld(); | 151 mutex().AssertHeld(); |
| 151 return data_pipe_->ProducerIsBusy(); | 152 return data_pipe_->ProducerIsBusy(); |
| 152 } | 153 } |
| 153 | 154 |
| 154 } // namespace system | 155 } // namespace system |
| 155 } // namespace mojo | 156 } // namespace mojo |
| OLD | NEW |