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

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

Issue 2060943007: Make it possible to remove an Awakable with a specific "context" from a Dispatcher. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 6 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/data_pipe.h ('k') | mojo/edk/system/data_pipe_consumer_dispatcher.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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 425
426 void DataPipe::ProducerRemoveAwakable(Awakable* awakable, 426 void DataPipe::ProducerRemoveAwakable(Awakable* awakable,
427 HandleSignalsState* signals_state) { 427 HandleSignalsState* signals_state) {
428 MutexLocker locker(&mutex_); 428 MutexLocker locker(&mutex_);
429 DCHECK(has_local_producer_no_lock()); 429 DCHECK(has_local_producer_no_lock());
430 producer_awakable_list_->Remove(awakable); 430 producer_awakable_list_->Remove(awakable);
431 if (signals_state) 431 if (signals_state)
432 *signals_state = impl_->ProducerGetHandleSignalsState(); 432 *signals_state = impl_->ProducerGetHandleSignalsState();
433 } 433 }
434 434
435 void DataPipe::ProducerRemoveAwakableWithContext(
436 Awakable* awakable,
437 uint64_t context,
438 HandleSignalsState* signals_state) {
439 MutexLocker locker(&mutex_);
440 DCHECK(has_local_producer_no_lock());
441 producer_awakable_list_->RemoveWithContext(awakable, context);
442 if (signals_state)
443 *signals_state = impl_->ProducerGetHandleSignalsState();
444 }
445
435 void DataPipe::ProducerStartSerialize(Channel* channel, 446 void DataPipe::ProducerStartSerialize(Channel* channel,
436 size_t* max_size, 447 size_t* max_size,
437 size_t* max_platform_handles) { 448 size_t* max_platform_handles) {
438 MutexLocker locker(&mutex_); 449 MutexLocker locker(&mutex_);
439 DCHECK(has_local_producer_no_lock()); 450 DCHECK(has_local_producer_no_lock());
440 impl_->ProducerStartSerialize(channel, max_size, max_platform_handles); 451 impl_->ProducerStartSerialize(channel, max_size, max_platform_handles);
441 } 452 }
442 453
443 bool DataPipe::ProducerEndSerialize( 454 bool DataPipe::ProducerEndSerialize(
444 Channel* channel, 455 Channel* channel,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 658
648 void DataPipe::ConsumerRemoveAwakable(Awakable* awakable, 659 void DataPipe::ConsumerRemoveAwakable(Awakable* awakable,
649 HandleSignalsState* signals_state) { 660 HandleSignalsState* signals_state) {
650 MutexLocker locker(&mutex_); 661 MutexLocker locker(&mutex_);
651 DCHECK(has_local_consumer_no_lock()); 662 DCHECK(has_local_consumer_no_lock());
652 consumer_awakable_list_->Remove(awakable); 663 consumer_awakable_list_->Remove(awakable);
653 if (signals_state) 664 if (signals_state)
654 *signals_state = impl_->ConsumerGetHandleSignalsState(); 665 *signals_state = impl_->ConsumerGetHandleSignalsState();
655 } 666 }
656 667
668 void DataPipe::ConsumerRemoveAwakableWithContext(
669 Awakable* awakable,
670 uint64_t context,
671 HandleSignalsState* signals_state) {
672 MutexLocker locker(&mutex_);
673 DCHECK(has_local_consumer_no_lock());
674 consumer_awakable_list_->RemoveWithContext(awakable, context);
675 if (signals_state)
676 *signals_state = impl_->ConsumerGetHandleSignalsState();
677 }
678
657 void DataPipe::ConsumerStartSerialize(Channel* channel, 679 void DataPipe::ConsumerStartSerialize(Channel* channel,
658 size_t* max_size, 680 size_t* max_size,
659 size_t* max_platform_handles) { 681 size_t* max_platform_handles) {
660 MutexLocker locker(&mutex_); 682 MutexLocker locker(&mutex_);
661 DCHECK(has_local_consumer_no_lock()); 683 DCHECK(has_local_consumer_no_lock());
662 impl_->ConsumerStartSerialize(channel, max_size, max_platform_handles); 684 impl_->ConsumerStartSerialize(channel, max_size, max_platform_handles);
663 } 685 }
664 686
665 bool DataPipe::ConsumerEndSerialize( 687 bool DataPipe::ConsumerEndSerialize(
666 Channel* channel, 688 Channel* channel,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 SetProducerClosedNoLock(); 875 SetProducerClosedNoLock();
854 } 876 }
855 877
856 void DataPipe::SetConsumerClosed() { 878 void DataPipe::SetConsumerClosed() {
857 MutexLocker locker(&mutex_); 879 MutexLocker locker(&mutex_);
858 SetConsumerClosedNoLock(); 880 SetConsumerClosedNoLock();
859 } 881 }
860 882
861 } // namespace system 883 } // namespace system
862 } // namespace mojo 884 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/data_pipe.h ('k') | mojo/edk/system/data_pipe_consumer_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698