| 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.h" | 5 #include "mojo/edk/system/data_pipe.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } | 392 } |
| 393 | 393 |
| 394 HandleSignalsState DataPipe::ProducerGetHandleSignalsState() { | 394 HandleSignalsState DataPipe::ProducerGetHandleSignalsState() { |
| 395 MutexLocker locker(&mutex_); | 395 MutexLocker locker(&mutex_); |
| 396 DCHECK(has_local_producer_no_lock()); | 396 DCHECK(has_local_producer_no_lock()); |
| 397 return impl_->ProducerGetHandleSignalsState(); | 397 return impl_->ProducerGetHandleSignalsState(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 MojoResult DataPipe::ProducerAddAwakable(Awakable* awakable, | 400 MojoResult DataPipe::ProducerAddAwakable(Awakable* awakable, |
| 401 MojoHandleSignals signals, | 401 MojoHandleSignals signals, |
| 402 uint32_t context, | 402 uint64_t context, |
| 403 HandleSignalsState* signals_state) { | 403 HandleSignalsState* signals_state) { |
| 404 MutexLocker locker(&mutex_); | 404 MutexLocker locker(&mutex_); |
| 405 DCHECK(has_local_producer_no_lock()); | 405 DCHECK(has_local_producer_no_lock()); |
| 406 | 406 |
| 407 HandleSignalsState producer_state = impl_->ProducerGetHandleSignalsState(); | 407 HandleSignalsState producer_state = impl_->ProducerGetHandleSignalsState(); |
| 408 if (producer_state.satisfies(signals)) { | 408 if (producer_state.satisfies(signals)) { |
| 409 if (signals_state) | 409 if (signals_state) |
| 410 *signals_state = producer_state; | 410 *signals_state = producer_state; |
| 411 return MOJO_RESULT_ALREADY_EXISTS; | 411 return MOJO_RESULT_ALREADY_EXISTS; |
| 412 } | 412 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 } | 611 } |
| 612 | 612 |
| 613 HandleSignalsState DataPipe::ConsumerGetHandleSignalsState() { | 613 HandleSignalsState DataPipe::ConsumerGetHandleSignalsState() { |
| 614 MutexLocker locker(&mutex_); | 614 MutexLocker locker(&mutex_); |
| 615 DCHECK(has_local_consumer_no_lock()); | 615 DCHECK(has_local_consumer_no_lock()); |
| 616 return impl_->ConsumerGetHandleSignalsState(); | 616 return impl_->ConsumerGetHandleSignalsState(); |
| 617 } | 617 } |
| 618 | 618 |
| 619 MojoResult DataPipe::ConsumerAddAwakable(Awakable* awakable, | 619 MojoResult DataPipe::ConsumerAddAwakable(Awakable* awakable, |
| 620 MojoHandleSignals signals, | 620 MojoHandleSignals signals, |
| 621 uint32_t context, | 621 uint64_t context, |
| 622 HandleSignalsState* signals_state) { | 622 HandleSignalsState* signals_state) { |
| 623 MutexLocker locker(&mutex_); | 623 MutexLocker locker(&mutex_); |
| 624 DCHECK(has_local_consumer_no_lock()); | 624 DCHECK(has_local_consumer_no_lock()); |
| 625 | 625 |
| 626 HandleSignalsState consumer_state = impl_->ConsumerGetHandleSignalsState(); | 626 HandleSignalsState consumer_state = impl_->ConsumerGetHandleSignalsState(); |
| 627 if (consumer_state.satisfies(signals)) { | 627 if (consumer_state.satisfies(signals)) { |
| 628 if (signals_state) | 628 if (signals_state) |
| 629 *signals_state = consumer_state; | 629 *signals_state = consumer_state; |
| 630 return MOJO_RESULT_ALREADY_EXISTS; | 630 return MOJO_RESULT_ALREADY_EXISTS; |
| 631 } | 631 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 SetProducerClosedNoLock(); | 847 SetProducerClosedNoLock(); |
| 848 } | 848 } |
| 849 | 849 |
| 850 void DataPipe::SetConsumerClosed() { | 850 void DataPipe::SetConsumerClosed() { |
| 851 MutexLocker locker(&mutex_); | 851 MutexLocker locker(&mutex_); |
| 852 SetConsumerClosedNoLock(); | 852 SetConsumerClosedNoLock(); |
| 853 } | 853 } |
| 854 | 854 |
| 855 } // namespace system | 855 } // namespace system |
| 856 } // namespace mojo | 856 } // namespace mojo |
| OLD | NEW |