Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: mojo/edk/system/data_pipe.cc

Issue 973513004: Allow data pipe producer/consumer handles to be re-sent. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/BUILD.gn ('k') | mojo/edk/system/data_pipe_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 base::AutoLock locker(lock_); 423 base::AutoLock locker(lock_);
424 DCHECK(has_local_producer_no_lock()); 424 DCHECK(has_local_producer_no_lock());
425 // Warning: After |ProducerEndSerialize()|, quite probably |impl_| has 425 // Warning: After |ProducerEndSerialize()|, quite probably |impl_| has
426 // changed. 426 // changed.
427 bool rv = impl_->ProducerEndSerialize(channel, destination, actual_size, 427 bool rv = impl_->ProducerEndSerialize(channel, destination, actual_size,
428 platform_handles); 428 platform_handles);
429 429
430 // TODO(vtl): The code below is similar to, but not quite the same as, 430 // TODO(vtl): The code below is similar to, but not quite the same as,
431 // |ProducerCloseNoLock()|. 431 // |ProducerCloseNoLock()|.
432 DCHECK(has_local_producer_no_lock()); 432 DCHECK(has_local_producer_no_lock());
433 producer_awakable_list_->CancelAll();
433 producer_awakable_list_.reset(); 434 producer_awakable_list_.reset();
434 // Not a bug, except possibly in "user" code. 435 // Not a bug, except possibly in "user" code.
435 DVLOG_IF(2, producer_in_two_phase_write_no_lock()) 436 DVLOG_IF(2, producer_in_two_phase_write_no_lock())
436 << "Producer transferred with active two-phase write"; 437 << "Producer transferred with active two-phase write";
437 producer_two_phase_max_num_bytes_written_ = 0; 438 producer_two_phase_max_num_bytes_written_ = 0;
439 if (!has_local_consumer_no_lock())
440 producer_open_ = false;
438 441
439 return rv; 442 return rv;
440 } 443 }
441 444
442 bool DataPipe::ProducerIsBusy() const { 445 bool DataPipe::ProducerIsBusy() const {
443 base::AutoLock locker(lock_); 446 base::AutoLock locker(lock_);
444 return producer_in_two_phase_write_no_lock(); 447 return producer_in_two_phase_write_no_lock();
445 } 448 }
446 449
447 void DataPipe::ConsumerCancelAllAwakables() { 450 void DataPipe::ConsumerCancelAllAwakables() {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 embedder::PlatformHandleVector* platform_handles) { 638 embedder::PlatformHandleVector* platform_handles) {
636 base::AutoLock locker(lock_); 639 base::AutoLock locker(lock_);
637 DCHECK(has_local_consumer_no_lock()); 640 DCHECK(has_local_consumer_no_lock());
638 // Warning: After |ConsumerEndSerialize()|, quite probably |impl_| has 641 // Warning: After |ConsumerEndSerialize()|, quite probably |impl_| has
639 // changed. 642 // changed.
640 bool rv = impl_->ConsumerEndSerialize(channel, destination, actual_size, 643 bool rv = impl_->ConsumerEndSerialize(channel, destination, actual_size,
641 platform_handles); 644 platform_handles);
642 645
643 // TODO(vtl): The code below is similar to, but not quite the same as, 646 // TODO(vtl): The code below is similar to, but not quite the same as,
644 // |ConsumerCloseNoLock()|. 647 // |ConsumerCloseNoLock()|.
648 consumer_awakable_list_->CancelAll();
645 consumer_awakable_list_.reset(); 649 consumer_awakable_list_.reset();
646 // Not a bug, except possibly in "user" code. 650 // Not a bug, except possibly in "user" code.
647 DVLOG_IF(2, consumer_in_two_phase_read_no_lock()) 651 DVLOG_IF(2, consumer_in_two_phase_read_no_lock())
648 << "Consumer transferred with active two-phase read"; 652 << "Consumer transferred with active two-phase read";
649 consumer_two_phase_max_num_bytes_read_ = 0; 653 consumer_two_phase_max_num_bytes_read_ = 0;
654 if (!has_local_producer_no_lock())
655 consumer_open_ = false;
650 656
651 return rv; 657 return rv;
652 } 658 }
653 659
654 bool DataPipe::ConsumerIsBusy() const { 660 bool DataPipe::ConsumerIsBusy() const {
655 base::AutoLock locker(lock_); 661 base::AutoLock locker(lock_);
656 return consumer_in_two_phase_read_no_lock(); 662 return consumer_in_two_phase_read_no_lock();
657 } 663 }
658 664
659 DataPipe::DataPipe(bool has_local_producer, 665 DataPipe::DataPipe(bool has_local_producer,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 SetProducerClosedNoLock(); 816 SetProducerClosedNoLock();
811 } 817 }
812 818
813 void DataPipe::SetConsumerClosed() { 819 void DataPipe::SetConsumerClosed() {
814 base::AutoLock locker(lock_); 820 base::AutoLock locker(lock_);
815 SetConsumerClosedNoLock(); 821 SetConsumerClosedNoLock();
816 } 822 }
817 823
818 } // namespace system 824 } // namespace system
819 } // namespace mojo 825 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/BUILD.gn ('k') | mojo/edk/system/data_pipe_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698