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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 1262253004: Let IPC::SyncMessageFilter take advantage of thread-safe Send. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_sync_channel.h" 5 #include "ipc/ipc_sync_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 StartWatching(); 453 StartWatching();
454 } 454 }
455 455
456 SyncChannel::~SyncChannel() { 456 SyncChannel::~SyncChannel() {
457 } 457 }
458 458
459 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { 459 void SyncChannel::SetRestrictDispatchChannelGroup(int group) {
460 sync_context()->set_restrict_dispatch_group(group); 460 sync_context()->set_restrict_dispatch_group(group);
461 } 461 }
462 462
463 scoped_refptr<IPC::SyncMessageFilter> SyncChannel::AddNewSyncMessageFilter() {
jam 2015/08/04 23:06:41 nit: usually functions that return a new objects s
Ken Rockot(use gerrit already) 2015/08/04 23:55:44 Done.
464 scoped_refptr<IPC::SyncMessageFilter> filter = new IPC::SyncMessageFilter(
jam 2015/08/04 23:06:41 nit: no IPC::
Ken Rockot(use gerrit already) 2015/08/04 23:55:45 Done.
465 sync_context()->shutdown_event(),
466 sync_context()->IsChannelSendThreadSafe());
467 AddFilter(filter.get());
468 return filter;
469 }
470
463 bool SyncChannel::Send(Message* message) { 471 bool SyncChannel::Send(Message* message) {
464 #ifdef IPC_MESSAGE_LOG_ENABLED 472 #ifdef IPC_MESSAGE_LOG_ENABLED
465 std::string name; 473 std::string name;
466 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL); 474 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL);
467 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name); 475 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name);
468 #else 476 #else
469 TRACE_EVENT2("ipc", "SyncChannel::Send", 477 TRACE_EVENT2("ipc", "SyncChannel::Send",
470 "class", IPC_MESSAGE_ID_CLASS(message->type()), 478 "class", IPC_MESSAGE_ID_CLASS(message->type()),
471 "line", IPC_MESSAGE_ID_LINE(message->type())); 479 "line", IPC_MESSAGE_ID_LINE(message->type()));
472 #endif 480 #endif
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 // manual reset since the object watcher might otherwise reset the event 586 // manual reset since the object watcher might otherwise reset the event
579 // when we're doing a WaitMany. 587 // when we're doing a WaitMany.
580 dispatch_watcher_callback_ = 588 dispatch_watcher_callback_ =
581 base::Bind(&SyncChannel::OnWaitableEventSignaled, 589 base::Bind(&SyncChannel::OnWaitableEventSignaled,
582 base::Unretained(this)); 590 base::Unretained(this));
583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), 591 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(),
584 dispatch_watcher_callback_); 592 dispatch_watcher_callback_);
585 } 593 }
586 594
587 } // namespace IPC 595 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698