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

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

Issue 1526563004: Fix shutdown assert with the new Mojo EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: real fix Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/message_pipe_dispatcher.h" 5 #include "mojo/edk/system/message_pipe_dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/stack_trace.h" 8 #include "base/debug/stack_trace.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 return MOJO_RESULT_OK; 611 return MOJO_RESULT_OK;
612 } 612 }
613 613
614 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock( 614 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
615 void* bytes, 615 void* bytes,
616 uint32_t* num_bytes, 616 uint32_t* num_bytes,
617 DispatcherVector* dispatchers, 617 DispatcherVector* dispatchers,
618 uint32_t* num_dispatchers, 618 uint32_t* num_dispatchers,
619 MojoReadMessageFlags flags) { 619 MojoReadMessageFlags flags) {
620 lock().AssertAcquired(); 620 lock().AssertAcquired();
621 if (channel_) { 621 if (transferable_ && channel_) {
622 channel_->EnsureLazyInitialized(); 622 channel_->EnsureLazyInitialized();
623 } else if (!transferable_) { 623 } else if (!transferable_) {
624 if (non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) { 624 if (non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) {
625 RequestNontransferableChannel(); 625 RequestNontransferableChannel();
626 return MOJO_RESULT_SHOULD_WAIT; 626 return MOJO_RESULT_SHOULD_WAIT;
627 } else if (non_transferable_state_ == CONNECT_CALLED) { 627 } else if (non_transferable_state_ == CONNECT_CALLED) {
628 return MOJO_RESULT_SHOULD_WAIT; 628 return MOJO_RESULT_SHOULD_WAIT;
629 } 629 }
630 } 630 }
631 631
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED; 711 rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
712 return rv; 712 return rv;
713 } 713 }
714 714
715 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock( 715 MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
716 Awakable* awakable, 716 Awakable* awakable,
717 MojoHandleSignals signals, 717 MojoHandleSignals signals,
718 uintptr_t context, 718 uintptr_t context,
719 HandleSignalsState* signals_state) { 719 HandleSignalsState* signals_state) {
720 lock().AssertAcquired(); 720 lock().AssertAcquired();
721 if (channel_) { 721 if (transferable_ && channel_) {
722 channel_->EnsureLazyInitialized(); 722 channel_->EnsureLazyInitialized();
723 } else if (!transferable_ && 723 } else if (!transferable_ &&
724 non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) { 724 non_transferable_state_ == WAITING_FOR_READ_OR_WRITE) {
725 RequestNontransferableChannel(); 725 RequestNontransferableChannel();
726 } 726 }
727 727
728 HandleSignalsState state = GetHandleSignalsStateImplNoLock(); 728 HandleSignalsState state = GetHandleSignalsStateImplNoLock();
729 if (state.satisfies(signals)) { 729 if (state.satisfies(signals)) {
730 if (signals_state) 730 if (signals_state)
731 *signals_state = state; 731 *signals_state = state;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 // PostTask since the broker can call us back synchronously. 1000 // PostTask since the broker can call us back synchronously.
1001 internal::g_io_thread_task_runner->PostTask( 1001 internal::g_io_thread_task_runner->PostTask(
1002 FROM_HERE, 1002 FROM_HERE,
1003 base::Bind(&Broker::ConnectMessagePipe, 1003 base::Bind(&Broker::ConnectMessagePipe,
1004 base::Unretained(internal::g_broker), pipe_id_, 1004 base::Unretained(internal::g_broker), pipe_id_,
1005 base::Unretained(this))); 1005 base::Unretained(this)));
1006 } 1006 }
1007 1007
1008 } // namespace edk 1008 } // namespace edk
1009 } // namespace mojo 1009 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/routed_raw_channel.cc » ('j') | mojo/edk/system/routed_raw_channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698