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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 1279863004: Complete SyncMessageFilter initialization after SyncChannel initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: eh, vector instead of list 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
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() { 463 scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() {
464 scoped_refptr<SyncMessageFilter> filter = new SyncMessageFilter( 464 scoped_refptr<SyncMessageFilter> filter = new SyncMessageFilter(
465 sync_context()->shutdown_event(), 465 sync_context()->shutdown_event(),
466 sync_context()->IsChannelSendThreadSafe()); 466 sync_context()->IsChannelSendThreadSafe());
467 AddFilter(filter.get()); 467 AddFilter(filter.get());
468 if (!did_init())
469 pre_init_sync_message_filters_.push_back(filter);
468 return filter; 470 return filter;
469 } 471 }
470 472
471 bool SyncChannel::Send(Message* message) { 473 bool SyncChannel::Send(Message* message) {
472 #ifdef IPC_MESSAGE_LOG_ENABLED 474 #ifdef IPC_MESSAGE_LOG_ENABLED
473 std::string name; 475 std::string name;
474 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL); 476 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL);
475 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name); 477 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name);
476 #else 478 #else
477 TRACE_EVENT2("ipc", "SyncChannel::Send", 479 TRACE_EVENT2("ipc", "SyncChannel::Send",
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // stop or keep watching. So we always watch it, and create the event as 587 // stop or keep watching. So we always watch it, and create the event as
586 // manual reset since the object watcher might otherwise reset the event 588 // manual reset since the object watcher might otherwise reset the event
587 // when we're doing a WaitMany. 589 // when we're doing a WaitMany.
588 dispatch_watcher_callback_ = 590 dispatch_watcher_callback_ =
589 base::Bind(&SyncChannel::OnWaitableEventSignaled, 591 base::Bind(&SyncChannel::OnWaitableEventSignaled,
590 base::Unretained(this)); 592 base::Unretained(this));
591 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), 593 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(),
592 dispatch_watcher_callback_); 594 dispatch_watcher_callback_);
593 } 595 }
594 596
597 void SyncChannel::OnChannelInit() {
598 for (const auto& filter : pre_init_sync_message_filters_) {
599 filter->set_is_channel_send_thread_safe(
600 context()->IsChannelSendThreadSafe());
601 }
602 pre_init_sync_message_filters_.clear();
603 }
604
595 } // namespace IPC 605 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698