| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/debug/leak_annotations.h" | 12 #include "base/debug/leak_annotations.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
| 16 #include "base/process/process_handle.h" | 16 #include "base/process/process_handle.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/synchronization/condition_variable.h" | 18 #include "base/synchronization/condition_variable.h" |
| 19 #include "base/synchronization/lock.h" | 19 #include "base/synchronization/lock.h" |
| 20 #include "base/threading/thread_local.h" | 20 #include "base/threading/thread_local.h" |
| 21 #include "base/tracked_objects.h" | 21 #include "base/tracked_objects.h" |
| 22 #include "components/tracing/child_trace_message_filter.h" | 22 #include "components/tracing/child_trace_message_filter.h" |
| 23 #include "content/child/child_histogram_message_filter.h" | 23 #include "content/child/child_histogram_message_filter.h" |
| 24 #include "content/child/child_process.h" | 24 #include "content/child/child_process.h" |
| 25 #include "content/child/child_resource_message_filter.h" | 25 #include "content/child/child_resource_message_filter.h" |
| 26 #include "content/child/child_shared_bitmap_manager.h" |
| 26 #include "content/child/fileapi/file_system_dispatcher.h" | 27 #include "content/child/fileapi/file_system_dispatcher.h" |
| 27 #include "content/child/power_monitor_broadcast_source.h" | 28 #include "content/child/power_monitor_broadcast_source.h" |
| 28 #include "content/child/quota_dispatcher.h" | 29 #include "content/child/quota_dispatcher.h" |
| 29 #include "content/child/quota_message_filter.h" | 30 #include "content/child/quota_message_filter.h" |
| 30 #include "content/child/resource_dispatcher.h" | 31 #include "content/child/resource_dispatcher.h" |
| 31 #include "content/child/service_worker/service_worker_dispatcher.h" | 32 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 32 #include "content/child/service_worker/service_worker_message_filter.h" | 33 #include "content/child/service_worker/service_worker_message_filter.h" |
| 33 #include "content/child/socket_stream_dispatcher.h" | 34 #include "content/child/socket_stream_dispatcher.h" |
| 34 #include "content/child/thread_safe_sender.h" | 35 #include "content/child/thread_safe_sender.h" |
| 35 #include "content/child/websocket_dispatcher.h" | 36 #include "content/child/websocket_dispatcher.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 g_lazy_child_thread_cv.Get().Signal(); | 244 g_lazy_child_thread_cv.Get().Signal(); |
| 244 #endif | 245 #endif |
| 245 | 246 |
| 246 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 247 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 247 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 248 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
| 248 message_loop_->message_loop_proxy(), | 249 message_loop_->message_loop_proxy(), |
| 249 ::HeapProfilerWithPseudoStackStart, | 250 ::HeapProfilerWithPseudoStackStart, |
| 250 ::HeapProfilerStop, | 251 ::HeapProfilerStop, |
| 251 ::GetHeapProfile)); | 252 ::GetHeapProfile)); |
| 252 #endif | 253 #endif |
| 254 |
| 255 shared_bitmap_manager_.reset( |
| 256 new ChildSharedBitmapManager(thread_safe_sender())); |
| 253 } | 257 } |
| 254 | 258 |
| 255 ChildThread::~ChildThread() { | 259 ChildThread::~ChildThread() { |
| 256 #ifdef IPC_MESSAGE_LOG_ENABLED | 260 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 257 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 261 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 258 #endif | 262 #endif |
| 259 | 263 |
| 260 channel_->RemoveFilter(histogram_message_filter_.get()); | 264 channel_->RemoveFilter(histogram_message_filter_.get()); |
| 261 channel_->RemoveFilter(sync_message_filter_.get()); | 265 channel_->RemoveFilter(sync_message_filter_.get()); |
| 262 | 266 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // inflight that would addref it. | 485 // inflight that would addref it. |
| 482 Send(new ChildProcessHostMsg_ShutdownRequest); | 486 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 483 } | 487 } |
| 484 | 488 |
| 485 void ChildThread::EnsureConnected() { | 489 void ChildThread::EnsureConnected() { |
| 486 VLOG(0) << "ChildThread::EnsureConnected()"; | 490 VLOG(0) << "ChildThread::EnsureConnected()"; |
| 487 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 491 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 488 } | 492 } |
| 489 | 493 |
| 490 } // namespace content | 494 } // namespace content |
| OLD | NEW |