| OLD | NEW |
| 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.h" | 5 #include "content/child/child_thread.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/allocator/allocator_extension.h" | 11 #include "base/allocator/allocator_extension.h" |
| 12 #include "base/base_switches.h" | 12 #include "base/base_switches.h" |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/message_loop/timer_slack.h" | 19 #include "base/message_loop/timer_slack.h" |
| 20 #include "base/process/kill.h" | 20 #include "base/process/kill.h" |
| 21 #include "base/process/process_handle.h" | 21 #include "base/process/process_handle.h" |
| 22 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/synchronization/condition_variable.h" | 24 #include "base/synchronization/condition_variable.h" |
| 25 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
| 26 #include "base/threading/thread_local.h" | 26 #include "base/threading/thread_local.h" |
| 27 #include "base/tracked_objects.h" | 27 #include "base/tracked_objects.h" |
| 28 #include "components/tracing/child_trace_message_filter.h" | 28 #include "components/tracing/child_trace_message_filter.h" |
| 29 #include "content/child/bluetooth/bluetooth_message_filter.h" |
| 29 #include "content/child/child_discardable_shared_memory_manager.h" | 30 #include "content/child/child_discardable_shared_memory_manager.h" |
| 30 #include "content/child/child_gpu_memory_buffer_manager.h" | 31 #include "content/child/child_gpu_memory_buffer_manager.h" |
| 31 #include "content/child/child_histogram_message_filter.h" | 32 #include "content/child/child_histogram_message_filter.h" |
| 32 #include "content/child/child_process.h" | 33 #include "content/child/child_process.h" |
| 33 #include "content/child/child_resource_message_filter.h" | 34 #include "content/child/child_resource_message_filter.h" |
| 34 #include "content/child/child_shared_bitmap_manager.h" | 35 #include "content/child/child_shared_bitmap_manager.h" |
| 35 #include "content/child/fileapi/file_system_dispatcher.h" | 36 #include "content/child/fileapi/file_system_dispatcher.h" |
| 36 #include "content/child/fileapi/webfilesystem_impl.h" | 37 #include "content/child/fileapi/webfilesystem_impl.h" |
| 37 #include "content/child/geofencing/geofencing_message_filter.h" | 38 #include "content/child/geofencing/geofencing_message_filter.h" |
| 38 #include "content/child/mojo/mojo_application.h" | 39 #include "content/child/mojo/mojo_application.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 285 |
| 285 service_worker_message_filter_ = | 286 service_worker_message_filter_ = |
| 286 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); | 287 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); |
| 287 | 288 |
| 288 quota_message_filter_ = | 289 quota_message_filter_ = |
| 289 new QuotaMessageFilter(thread_safe_sender_.get()); | 290 new QuotaMessageFilter(thread_safe_sender_.get()); |
| 290 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), | 291 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), |
| 291 quota_message_filter_.get())); | 292 quota_message_filter_.get())); |
| 292 geofencing_message_filter_ = | 293 geofencing_message_filter_ = |
| 293 new GeofencingMessageFilter(thread_safe_sender_.get()); | 294 new GeofencingMessageFilter(thread_safe_sender_.get()); |
| 295 bluetooth_message_filter_ = |
| 296 new BluetoothMessageFilter(thread_safe_sender_.get()); |
| 294 notification_dispatcher_ = | 297 notification_dispatcher_ = |
| 295 new NotificationDispatcher(thread_safe_sender_.get()); | 298 new NotificationDispatcher(thread_safe_sender_.get()); |
| 296 channel_->AddFilter(histogram_message_filter_.get()); | 299 channel_->AddFilter(histogram_message_filter_.get()); |
| 297 channel_->AddFilter(sync_message_filter_.get()); | 300 channel_->AddFilter(sync_message_filter_.get()); |
| 298 channel_->AddFilter(resource_message_filter_.get()); | 301 channel_->AddFilter(resource_message_filter_.get()); |
| 299 channel_->AddFilter(quota_message_filter_->GetFilter()); | 302 channel_->AddFilter(quota_message_filter_->GetFilter()); |
| 300 channel_->AddFilter(notification_dispatcher_->GetFilter()); | 303 channel_->AddFilter(notification_dispatcher_->GetFilter()); |
| 301 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 304 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 302 channel_->AddFilter(geofencing_message_filter_->GetFilter()); | 305 channel_->AddFilter(geofencing_message_filter_->GetFilter()); |
| 306 channel_->AddFilter(bluetooth_message_filter_->GetFilter()); |
| 303 | 307 |
| 304 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 308 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 305 switches::kSingleProcess)) { | 309 switches::kSingleProcess)) { |
| 306 // In single process mode, browser-side tracing will cover the whole | 310 // In single process mode, browser-side tracing will cover the whole |
| 307 // process including renderers. | 311 // process including renderers. |
| 308 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 312 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 309 ChildProcess::current()->io_message_loop_proxy())); | 313 ChildProcess::current()->io_message_loop_proxy())); |
| 310 } | 314 } |
| 311 | 315 |
| 312 // In single process mode we may already have a power monitor | 316 // In single process mode we may already have a power monitor |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 601 |
| 598 void ChildThread::OnProcessBackgrounded(bool background) { | 602 void ChildThread::OnProcessBackgrounded(bool background) { |
| 599 // Set timer slack to maximum on main thread when in background. | 603 // Set timer slack to maximum on main thread when in background. |
| 600 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 604 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
| 601 if (background) | 605 if (background) |
| 602 timer_slack = base::TIMER_SLACK_MAXIMUM; | 606 timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 603 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 607 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
| 604 } | 608 } |
| 605 | 609 |
| 606 } // namespace content | 610 } // namespace content |
| OLD | NEW |