| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 | 649 |
| 650 bool DataPipe::ConsumerIsBusy() const { | 650 bool DataPipe::ConsumerIsBusy() const { |
| 651 MutexLocker locker(&mutex_); | 651 MutexLocker locker(&mutex_); |
| 652 return consumer_in_two_phase_read_no_lock(); | 652 return consumer_in_two_phase_read_no_lock(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 DataPipe::DataPipe(bool has_local_producer, | 655 DataPipe::DataPipe(bool has_local_producer, |
| 656 bool has_local_consumer, | 656 bool has_local_consumer, |
| 657 const MojoCreateDataPipeOptions& validated_options, | 657 const MojoCreateDataPipeOptions& validated_options, |
| 658 std::unique_ptr<DataPipeImpl> impl) | 658 std::unique_ptr<DataPipeImpl> impl) |
| 659 : validated_options_(validated_options), | 659 : element_num_bytes_(validated_options.element_num_bytes), |
| 660 capacity_num_bytes_(validated_options.capacity_num_bytes), |
| 660 producer_open_(true), | 661 producer_open_(true), |
| 661 consumer_open_(true), | 662 consumer_open_(true), |
| 662 producer_awakable_list_(has_local_producer ? new AwakableList() | 663 producer_awakable_list_(has_local_producer ? new AwakableList() |
| 663 : nullptr), | 664 : nullptr), |
| 664 consumer_awakable_list_(has_local_consumer ? new AwakableList() | 665 consumer_awakable_list_(has_local_consumer ? new AwakableList() |
| 665 : nullptr), | 666 : nullptr), |
| 666 producer_two_phase_max_num_bytes_written_(0), | 667 producer_two_phase_max_num_bytes_written_(0), |
| 667 consumer_two_phase_max_num_bytes_read_(0), | 668 consumer_two_phase_max_num_bytes_read_(0), |
| 668 impl_(std::move(impl)) { | 669 impl_(std::move(impl)) { |
| 669 impl_->set_owner(this); | 670 impl_->set_owner(this); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 SetProducerClosedNoLock(); | 807 SetProducerClosedNoLock(); |
| 807 } | 808 } |
| 808 | 809 |
| 809 void DataPipe::SetConsumerClosed() { | 810 void DataPipe::SetConsumerClosed() { |
| 810 MutexLocker locker(&mutex_); | 811 MutexLocker locker(&mutex_); |
| 811 SetConsumerClosedNoLock(); | 812 SetConsumerClosedNoLock(); |
| 812 } | 813 } |
| 813 | 814 |
| 814 } // namespace system | 815 } // namespace system |
| 815 } // namespace mojo | 816 } // namespace mojo |
| OLD | NEW |