| 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/child_gpu_memory_buffer_manager.h" |
| 29 #include "content/child/child_histogram_message_filter.h" | 30 #include "content/child/child_histogram_message_filter.h" |
| 30 #include "content/child/child_process.h" | 31 #include "content/child/child_process.h" |
| 31 #include "content/child/child_resource_message_filter.h" | 32 #include "content/child/child_resource_message_filter.h" |
| 32 #include "content/child/child_shared_bitmap_manager.h" | 33 #include "content/child/child_shared_bitmap_manager.h" |
| 33 #include "content/child/fileapi/file_system_dispatcher.h" | 34 #include "content/child/fileapi/file_system_dispatcher.h" |
| 34 #include "content/child/fileapi/webfilesystem_impl.h" | 35 #include "content/child/fileapi/webfilesystem_impl.h" |
| 35 #include "content/child/geofencing/geofencing_message_filter.h" | 36 #include "content/child/geofencing/geofencing_message_filter.h" |
| 36 #include "content/child/mojo/mojo_application.h" | 37 #include "content/child/mojo/mojo_application.h" |
| 37 #include "content/child/power_monitor_broadcast_source.h" | 38 #include "content/child/power_monitor_broadcast_source.h" |
| 38 #include "content/child/quota_dispatcher.h" | 39 #include "content/child/quota_dispatcher.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 354 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 354 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 355 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
| 355 message_loop_->message_loop_proxy(), | 356 message_loop_->message_loop_proxy(), |
| 356 ::HeapProfilerWithPseudoStackStart, | 357 ::HeapProfilerWithPseudoStackStart, |
| 357 ::HeapProfilerStop, | 358 ::HeapProfilerStop, |
| 358 ::GetHeapProfile)); | 359 ::GetHeapProfile)); |
| 359 #endif | 360 #endif |
| 360 | 361 |
| 361 shared_bitmap_manager_.reset( | 362 shared_bitmap_manager_.reset( |
| 362 new ChildSharedBitmapManager(thread_safe_sender())); | 363 new ChildSharedBitmapManager(thread_safe_sender())); |
| 364 |
| 365 gpu_memory_buffer_manager_.reset( |
| 366 new ChildGpuMemoryBufferManager(thread_safe_sender())); |
| 363 } | 367 } |
| 364 | 368 |
| 365 ChildThread::~ChildThread() { | 369 ChildThread::~ChildThread() { |
| 366 #ifdef IPC_MESSAGE_LOG_ENABLED | 370 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 367 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 371 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 368 #endif | 372 #endif |
| 369 | 373 |
| 370 channel_->RemoveFilter(histogram_message_filter_.get()); | 374 channel_->RemoveFilter(histogram_message_filter_.get()); |
| 371 channel_->RemoveFilter(sync_message_filter_.get()); | 375 channel_->RemoveFilter(sync_message_filter_.get()); |
| 372 | 376 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 | 595 |
| 592 void ChildThread::OnProcessBackgrounded(bool background) { | 596 void ChildThread::OnProcessBackgrounded(bool background) { |
| 593 // Set timer slack to maximum on main thread when in background. | 597 // Set timer slack to maximum on main thread when in background. |
| 594 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; | 598 base::TimerSlack timer_slack = base::TIMER_SLACK_NONE; |
| 595 if (background) | 599 if (background) |
| 596 timer_slack = base::TIMER_SLACK_MAXIMUM; | 600 timer_slack = base::TIMER_SLACK_MAXIMUM; |
| 597 base::MessageLoop::current()->SetTimerSlack(timer_slack); | 601 base::MessageLoop::current()->SetTimerSlack(timer_slack); |
| 598 } | 602 } |
| 599 | 603 |
| 600 } // namespace content | 604 } // namespace content |
| OLD | NEW |