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

Side by Side Diff: ipc/ipc_mojo_bootstrap.cc

Issue 2481963002: IPC: Relax thread constraints on Channel-associated send (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ipc/ipc_mojo_bootstrap.h" 5 #include "ipc/ipc_mojo_bootstrap.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 bool SendMessage(mojo::Message* message) { 478 bool SendMessage(mojo::Message* message) {
479 if (task_runner_->BelongsToCurrentThread()) { 479 if (task_runner_->BelongsToCurrentThread()) {
480 DCHECK(thread_checker_.CalledOnValidThread()); 480 DCHECK(thread_checker_.CalledOnValidThread());
481 if (!connector_ || paused_) { 481 if (!connector_ || paused_) {
482 outgoing_messages_.emplace_back(std::move(*message)); 482 outgoing_messages_.emplace_back(std::move(*message));
483 return true; 483 return true;
484 } 484 }
485 return connector_->Accept(message); 485 return connector_->Accept(message);
486 } else { 486 } else {
487 // We always post tasks to the master endpoint thread when called from the 487 // We always post tasks to the master endpoint thread when called from
488 // proxy thread in order to simulate IPC::ChannelProxy::Send behavior. 488 // other threads in order to simulate IPC::ChannelProxy::Send behavior.
489 DCHECK(proxy_task_runner_->BelongsToCurrentThread());
490 task_runner_->PostTask( 489 task_runner_->PostTask(
491 FROM_HERE, 490 FROM_HERE,
492 base::Bind( 491 base::Bind(
493 &ChannelAssociatedGroupController::SendMessageOnMasterThread, 492 &ChannelAssociatedGroupController::SendMessageOnMasterThread,
494 this, base::Passed(message))); 493 this, base::Passed(message)));
495 return true; 494 return true;
496 } 495 }
497 } 496 }
498 497
499 void SendMessageOnMasterThread(mojo::Message message) { 498 void SendMessageOnMasterThread(mojo::Message message) {
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 Channel::Mode mode, 842 Channel::Mode mode,
844 Delegate* delegate, 843 Delegate* delegate,
845 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) { 844 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner) {
846 return base::MakeUnique<MojoBootstrapImpl>( 845 return base::MakeUnique<MojoBootstrapImpl>(
847 std::move(handle), delegate, 846 std::move(handle), delegate,
848 new ChannelAssociatedGroupController(mode == Channel::MODE_SERVER, 847 new ChannelAssociatedGroupController(mode == Channel::MODE_SERVER,
849 ipc_task_runner)); 848 ipc_task_runner));
850 } 849 }
851 850
852 } // namespace IPC 851 } // namespace IPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698