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

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

Issue 1501343002: Prepare chrome to use the new Mojo EDK by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable turning on in this cl 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 calling_init_(false), 411 calling_init_(false),
412 write_error_(false), 412 write_error_(false),
413 transferable_(transferable) { 413 transferable_(transferable) {
414 } 414 }
415 415
416 MessagePipeDispatcher::~MessagePipeDispatcher() { 416 MessagePipeDispatcher::~MessagePipeDispatcher() {
417 // |Close()|/|CloseImplNoLock()| should have taken care of the channel. The 417 // |Close()|/|CloseImplNoLock()| should have taken care of the channel. The
418 // exception is if they posted a task to run CloseOnIO but the IO thread shut 418 // exception is if they posted a task to run CloseOnIO but the IO thread shut
419 // down and so when it was deleting pending tasks it caused the last reference 419 // down and so when it was deleting pending tasks it caused the last reference
420 // to destruct this object. In that case, safe to destroy the channel. 420 // to destruct this object. In that case, safe to destroy the channel.
421 if (channel_ && internal::g_io_thread_task_runner->RunsTasksOnCurrentThread()) 421 if (channel_ &&
422 channel_->Shutdown(); 422 internal::g_io_thread_task_runner->RunsTasksOnCurrentThread()) {
423 else 423 if (transferable_) {
424 channel_->Shutdown();
425 } else {
426 internal::g_broker->CloseMessagePipe(pipe_id_, this);
427 }
428 } else {
424 DCHECK(!channel_); 429 DCHECK(!channel_);
430 }
425 #if defined(OS_POSIX) 431 #if defined(OS_POSIX)
426 ClosePlatformHandles(&serialized_fds_); 432 ClosePlatformHandles(&serialized_fds_);
427 #endif 433 #endif
428 } 434 }
429 435
430 void MessagePipeDispatcher::CancelAllAwakablesNoLock() { 436 void MessagePipeDispatcher::CancelAllAwakablesNoLock() {
431 lock().AssertAcquired(); 437 lock().AssertAcquired();
432 awakable_list_.CancelAll(); 438 awakable_list_.CancelAll();
433 } 439 }
434 440
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
994 // PostTask since the broker can call us back synchronously. 1000 // PostTask since the broker can call us back synchronously.
995 internal::g_io_thread_task_runner->PostTask( 1001 internal::g_io_thread_task_runner->PostTask(
996 FROM_HERE, 1002 FROM_HERE,
997 base::Bind(&Broker::ConnectMessagePipe, 1003 base::Bind(&Broker::ConnectMessagePipe,
998 base::Unretained(internal::g_broker), pipe_id_, 1004 base::Unretained(internal::g_broker), pipe_id_,
999 base::Unretained(this))); 1005 base::Unretained(this)));
1000 } 1006 }
1001 1007
1002 } // namespace edk 1008 } // namespace edk
1003 } // namespace mojo 1009 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698