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

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

Issue 1943123002: Make it possible to write a message pipe endpoint's peer into it. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
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/dispatcher.h" 5 #include "mojo/edk/system/dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/system/configuration.h" 8 #include "mojo/edk/system/configuration.h"
9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 519
520 void Dispatcher::CloseNoLock() { 520 void Dispatcher::CloseNoLock() {
521 mutex_.AssertHeld(); 521 mutex_.AssertHeld();
522 DCHECK(!is_closed_); 522 DCHECK(!is_closed_);
523 523
524 is_closed_ = true; 524 is_closed_ = true;
525 CancelAllAwakablesNoLock(); 525 CancelAllAwakablesNoLock();
526 CloseImplNoLock(); 526 CloseImplNoLock();
527 } 527 }
528 528
529 RefPtr<Dispatcher> Dispatcher::CreateEquivalentDispatcherAndCloseNoLock() { 529 RefPtr<Dispatcher> Dispatcher::CreateEquivalentDispatcherAndCloseNoLock(
530 MessagePipe* message_pipe,
531 unsigned port) {
530 mutex_.AssertHeld(); 532 mutex_.AssertHeld();
531 DCHECK(!is_closed_); 533 DCHECK(!is_closed_);
532 534
533 is_closed_ = true; 535 is_closed_ = true;
534 CancelAllAwakablesNoLock(); 536 return CreateEquivalentDispatcherAndCloseImplNoLock(message_pipe, port);
535 return CreateEquivalentDispatcherAndCloseImplNoLock();
536 } 537 }
537 538
538 void Dispatcher::StartSerialize(Channel* channel, 539 void Dispatcher::StartSerialize(Channel* channel,
539 size_t* max_size, 540 size_t* max_size,
540 size_t* max_platform_handles) { 541 size_t* max_platform_handles) {
541 DCHECK(channel); 542 DCHECK(channel);
542 DCHECK(max_size); 543 DCHECK(max_size);
543 DCHECK(max_platform_handles); 544 DCHECK(max_platform_handles);
544 AssertHasOneRef(); // Only one ref => no need to take the lock. 545 AssertHasOneRef(); // Only one ref => no need to take the lock.
545 DCHECK(!is_closed_); 546 DCHECK(!is_closed_);
(...skipping 29 matching lines...) Expand all
575 // DispatcherTransport --------------------------------------------------------- 576 // DispatcherTransport ---------------------------------------------------------
576 577
577 void DispatcherTransport::End() { 578 void DispatcherTransport::End() {
578 DCHECK(dispatcher_); 579 DCHECK(dispatcher_);
579 dispatcher_->mutex_.Unlock(); 580 dispatcher_->mutex_.Unlock();
580 dispatcher_ = nullptr; 581 dispatcher_ = nullptr;
581 } 582 }
582 583
583 } // namespace system 584 } // namespace system
584 } // namespace mojo 585 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698