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/system/data_pipe_producer_dispatcher.h" | 5 #include "mojo/system/data_pipe_producer_dispatcher.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/system/data_pipe.h" | 8 #include "mojo/system/data_pipe.h" |
9 #include "mojo/system/memory.h" | 9 #include "mojo/system/memory.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 void DataPipeProducerDispatcher::CancelAllWaitersNoLock() { | 31 void DataPipeProducerDispatcher::CancelAllWaitersNoLock() { |
32 lock().AssertAcquired(); | 32 lock().AssertAcquired(); |
33 data_pipe_->ProducerCancelAllWaiters(); | 33 data_pipe_->ProducerCancelAllWaiters(); |
34 } | 34 } |
35 | 35 |
36 void DataPipeProducerDispatcher::CloseImplNoLock() { | 36 void DataPipeProducerDispatcher::CloseImplNoLock() { |
37 lock().AssertAcquired(); | 37 lock().AssertAcquired(); |
38 data_pipe_->ProducerClose(); | 38 data_pipe_->ProducerClose(); |
39 data_pipe_ = NULL; | 39 data_pipe_ = nullptr; |
40 } | 40 } |
41 | 41 |
42 scoped_refptr<Dispatcher> | 42 scoped_refptr<Dispatcher> |
43 DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { | 43 DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { |
44 lock().AssertAcquired(); | 44 lock().AssertAcquired(); |
45 | 45 |
46 scoped_refptr<DataPipeProducerDispatcher> rv = | 46 scoped_refptr<DataPipeProducerDispatcher> rv = |
47 new DataPipeProducerDispatcher(); | 47 new DataPipeProducerDispatcher(); |
48 rv->Init(data_pipe_); | 48 rv->Init(data_pipe_); |
49 data_pipe_ = NULL; | 49 data_pipe_ = nullptr; |
50 return scoped_refptr<Dispatcher>(rv.get()); | 50 return scoped_refptr<Dispatcher>(rv.get()); |
51 } | 51 } |
52 | 52 |
53 MojoResult DataPipeProducerDispatcher::WriteDataImplNoLock( | 53 MojoResult DataPipeProducerDispatcher::WriteDataImplNoLock( |
54 UserPointer<const void> elements, | 54 UserPointer<const void> elements, |
55 UserPointer<uint32_t> num_bytes, | 55 UserPointer<uint32_t> num_bytes, |
56 MojoWriteDataFlags flags) { | 56 MojoWriteDataFlags flags) { |
57 lock().AssertAcquired(); | 57 lock().AssertAcquired(); |
58 return data_pipe_->ProducerWriteData( | 58 return data_pipe_->ProducerWriteData( |
59 elements, num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); | 59 elements, num_bytes, (flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 data_pipe_->ProducerRemoveWaiter(waiter, signals_state); | 98 data_pipe_->ProducerRemoveWaiter(waiter, signals_state); |
99 } | 99 } |
100 | 100 |
101 bool DataPipeProducerDispatcher::IsBusyNoLock() const { | 101 bool DataPipeProducerDispatcher::IsBusyNoLock() const { |
102 lock().AssertAcquired(); | 102 lock().AssertAcquired(); |
103 return data_pipe_->ProducerIsBusy(); | 103 return data_pipe_->ProducerIsBusy(); |
104 } | 104 } |
105 | 105 |
106 } // namespace system | 106 } // namespace system |
107 } // namespace mojo | 107 } // namespace mojo |
OLD | NEW |