| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { | 22 Dispatcher::Type DataPipeConsumerDispatcher::GetType() const { |
| 23 return kTypeDataPipeConsumer; | 23 return kTypeDataPipeConsumer; |
| 24 } | 24 } |
| 25 | 25 |
| 26 DataPipeConsumerDispatcher::~DataPipeConsumerDispatcher() { | 26 DataPipeConsumerDispatcher::~DataPipeConsumerDispatcher() { |
| 27 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe. | 27 // |Close()|/|CloseImplNoLock()| should have taken care of the pipe. |
| 28 DCHECK(!data_pipe_.get()); | 28 DCHECK(!data_pipe_.get()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void DataPipeConsumerDispatcher::CancelAllWaitersNoLock() { | 31 void DataPipeConsumerDispatcher::CancelAllAwakablesNoLock() { |
| 32 lock().AssertAcquired(); | 32 lock().AssertAcquired(); |
| 33 data_pipe_->ConsumerCancelAllWaiters(); | 33 data_pipe_->ConsumerCancelAllAwakables(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void DataPipeConsumerDispatcher::CloseImplNoLock() { | 36 void DataPipeConsumerDispatcher::CloseImplNoLock() { |
| 37 lock().AssertAcquired(); | 37 lock().AssertAcquired(); |
| 38 data_pipe_->ConsumerClose(); | 38 data_pipe_->ConsumerClose(); |
| 39 data_pipe_ = nullptr; | 39 data_pipe_ = nullptr; |
| 40 } | 40 } |
| 41 | 41 |
| 42 scoped_refptr<Dispatcher> | 42 scoped_refptr<Dispatcher> |
| 43 DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { | 43 DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 102 |
| 103 return data_pipe_->ConsumerEndReadData(num_bytes_read); | 103 return data_pipe_->ConsumerEndReadData(num_bytes_read); |
| 104 } | 104 } |
| 105 | 105 |
| 106 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() | 106 HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock() |
| 107 const { | 107 const { |
| 108 lock().AssertAcquired(); | 108 lock().AssertAcquired(); |
| 109 return data_pipe_->ConsumerGetHandleSignalsState(); | 109 return data_pipe_->ConsumerGetHandleSignalsState(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 MojoResult DataPipeConsumerDispatcher::AddWaiterImplNoLock( | 112 MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock( |
| 113 Waiter* waiter, | 113 Awakable* awakable, |
| 114 MojoHandleSignals signals, | 114 MojoHandleSignals signals, |
| 115 uint32_t context, | 115 uint32_t context, |
| 116 HandleSignalsState* signals_state) { | 116 HandleSignalsState* signals_state) { |
| 117 lock().AssertAcquired(); | 117 lock().AssertAcquired(); |
| 118 return data_pipe_->ConsumerAddWaiter(waiter, signals, context, signals_state); | 118 return data_pipe_->ConsumerAddAwakable(awakable, signals, context, |
| 119 signals_state); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void DataPipeConsumerDispatcher::RemoveWaiterImplNoLock( | 122 void DataPipeConsumerDispatcher::RemoveAwakableImplNoLock( |
| 122 Waiter* waiter, | 123 Awakable* awakable, |
| 123 HandleSignalsState* signals_state) { | 124 HandleSignalsState* signals_state) { |
| 124 lock().AssertAcquired(); | 125 lock().AssertAcquired(); |
| 125 data_pipe_->ConsumerRemoveWaiter(waiter, signals_state); | 126 data_pipe_->ConsumerRemoveAwakable(awakable, signals_state); |
| 126 } | 127 } |
| 127 | 128 |
| 128 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { | 129 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { |
| 129 lock().AssertAcquired(); | 130 lock().AssertAcquired(); |
| 130 return data_pipe_->ConsumerIsBusy(); | 131 return data_pipe_->ConsumerIsBusy(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace system | 134 } // namespace system |
| 134 } // namespace mojo | 135 } // namespace mojo |
| OLD | NEW |