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

Side by Side Diff: content/child/child_thread_impl.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: minus some code 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 "content/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (!IsInBrowserProcess()) 359 if (!IsInBrowserProcess())
360 IPC::Logging::GetInstance()->SetIPCSender(this); 360 IPC::Logging::GetInstance()->SetIPCSender(this);
361 #endif 361 #endif
362 362
363 #if defined(OS_WIN) 363 #if defined(OS_WIN)
364 attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin()); 364 attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin());
365 #endif 365 #endif
366 366
367 mojo_application_.reset(new MojoApplication(GetIOTaskRunner())); 367 mojo_application_.reset(new MojoApplication(GetIOTaskRunner()));
368 368
369 sync_message_filter_ = 369 sync_message_filter_ = channel_->CreateSyncMessageFilter();
370 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
371 thread_safe_sender_ = new ThreadSafeSender( 370 thread_safe_sender_ = new ThreadSafeSender(
372 message_loop_->task_runner(), sync_message_filter_.get()); 371 message_loop_->task_runner(), sync_message_filter_.get());
373 372
374 resource_dispatcher_.reset(new ResourceDispatcher( 373 resource_dispatcher_.reset(new ResourceDispatcher(
375 this, message_loop()->task_runner())); 374 this, message_loop()->task_runner()));
376 websocket_dispatcher_.reset(new WebSocketDispatcher); 375 websocket_dispatcher_.reset(new WebSocketDispatcher);
377 file_system_dispatcher_.reset(new FileSystemDispatcher()); 376 file_system_dispatcher_.reset(new FileSystemDispatcher());
378 377
379 histogram_message_filter_ = new ChildHistogramMessageFilter(); 378 histogram_message_filter_ = new ChildHistogramMessageFilter();
380 resource_message_filter_ = 379 resource_message_filter_ =
381 new ChildResourceMessageFilter(resource_dispatcher()); 380 new ChildResourceMessageFilter(resource_dispatcher());
382 381
383 service_worker_message_filter_ = 382 service_worker_message_filter_ =
384 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); 383 new ServiceWorkerMessageFilter(thread_safe_sender_.get());
385 384
386 quota_message_filter_ = 385 quota_message_filter_ =
387 new QuotaMessageFilter(thread_safe_sender_.get()); 386 new QuotaMessageFilter(thread_safe_sender_.get());
388 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), 387 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(),
389 quota_message_filter_.get())); 388 quota_message_filter_.get()));
390 geofencing_message_filter_ = 389 geofencing_message_filter_ =
391 new GeofencingMessageFilter(thread_safe_sender_.get()); 390 new GeofencingMessageFilter(thread_safe_sender_.get());
392 notification_dispatcher_ = 391 notification_dispatcher_ =
393 new NotificationDispatcher(thread_safe_sender_.get()); 392 new NotificationDispatcher(thread_safe_sender_.get());
394 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); 393 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get());
395 394
396 channel_->AddFilter(histogram_message_filter_.get()); 395 channel_->AddFilter(histogram_message_filter_.get());
397 channel_->AddFilter(sync_message_filter_.get());
398 channel_->AddFilter(resource_message_filter_.get()); 396 channel_->AddFilter(resource_message_filter_.get());
399 channel_->AddFilter(quota_message_filter_->GetFilter()); 397 channel_->AddFilter(quota_message_filter_->GetFilter());
400 channel_->AddFilter(notification_dispatcher_->GetFilter()); 398 channel_->AddFilter(notification_dispatcher_->GetFilter());
401 channel_->AddFilter(push_dispatcher_->GetFilter()); 399 channel_->AddFilter(push_dispatcher_->GetFilter());
402 channel_->AddFilter(service_worker_message_filter_->GetFilter()); 400 channel_->AddFilter(service_worker_message_filter_->GetFilter());
403 channel_->AddFilter(geofencing_message_filter_->GetFilter()); 401 channel_->AddFilter(geofencing_message_filter_->GetFilter());
404 402
405 if (!IsInBrowserProcess()) { 403 if (!IsInBrowserProcess()) {
406 // In single process mode, browser-side tracing will cover the whole 404 // In single process mode, browser-side tracing will cover the whole
407 // process including renderers. 405 // process including renderers.
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 707
710 void ChildThreadImpl::OnProcessBackgrounded(bool background) { 708 void ChildThreadImpl::OnProcessBackgrounded(bool background) {
711 // Set timer slack to maximum on main thread when in background. 709 // Set timer slack to maximum on main thread when in background.
712 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; 710 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE;
713 if (background) 711 if (background)
714 timer_slack = base::TIMER_SLACK_MAXIMUM; 712 timer_slack = base::TIMER_SLACK_MAXIMUM;
715 base::MessageLoop::current()->SetTimerSlack(timer_slack); 713 base::MessageLoop::current()->SetTimerSlack(timer_slack);
716 } 714 }
717 715
718 } // namespace content 716 } // namespace content
OLDNEW
« no previous file with comments | « components/nacl/loader/nacl_listener.cc ('k') | content/child/indexed_db/indexed_db_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698