| 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/process/kill.h" | 19 #include "base/process/kill.h" |
| 20 #include "base/process/process_handle.h" | 20 #include "base/process/process_handle.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
| 23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 24 #include "base/threading/thread_local.h" | 24 #include "base/threading/thread_local.h" |
| 25 #include "base/tracked_objects.h" | 25 #include "base/tracked_objects.h" |
| 26 #include "components/tracing/child_trace_message_filter.h" | 26 #include "components/tracing/child_trace_message_filter.h" |
| 27 #include "content/child/child_histogram_message_filter.h" | 27 #include "content/child/child_histogram_message_filter.h" |
| 28 #include "content/child/child_process.h" | 28 #include "content/child/child_process.h" |
| 29 #include "content/child/child_resource_message_filter.h" | 29 #include "content/child/child_resource_message_filter.h" |
| 30 #include "content/child/child_shared_bitmap_manager.h" |
| 30 #include "content/child/fileapi/file_system_dispatcher.h" | 31 #include "content/child/fileapi/file_system_dispatcher.h" |
| 31 #include "content/child/power_monitor_broadcast_source.h" | 32 #include "content/child/power_monitor_broadcast_source.h" |
| 32 #include "content/child/quota_dispatcher.h" | 33 #include "content/child/quota_dispatcher.h" |
| 33 #include "content/child/quota_message_filter.h" | 34 #include "content/child/quota_message_filter.h" |
| 34 #include "content/child/resource_dispatcher.h" | 35 #include "content/child/resource_dispatcher.h" |
| 35 #include "content/child/service_worker/service_worker_dispatcher.h" | 36 #include "content/child/service_worker/service_worker_dispatcher.h" |
| 36 #include "content/child/service_worker/service_worker_message_filter.h" | 37 #include "content/child/service_worker/service_worker_message_filter.h" |
| 37 #include "content/child/socket_stream_dispatcher.h" | 38 #include "content/child/socket_stream_dispatcher.h" |
| 38 #include "content/child/thread_safe_sender.h" | 39 #include "content/child/thread_safe_sender.h" |
| 39 #include "content/child/websocket_dispatcher.h" | 40 #include "content/child/websocket_dispatcher.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 g_lazy_child_thread_cv.Get().Signal(); | 295 g_lazy_child_thread_cv.Get().Signal(); |
| 295 #endif | 296 #endif |
| 296 | 297 |
| 297 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 298 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 298 trace_memory_controller_.reset(new base::debug::TraceMemoryController( | 299 trace_memory_controller_.reset(new base::debug::TraceMemoryController( |
| 299 message_loop_->message_loop_proxy(), | 300 message_loop_->message_loop_proxy(), |
| 300 ::HeapProfilerWithPseudoStackStart, | 301 ::HeapProfilerWithPseudoStackStart, |
| 301 ::HeapProfilerStop, | 302 ::HeapProfilerStop, |
| 302 ::GetHeapProfile)); | 303 ::GetHeapProfile)); |
| 303 #endif | 304 #endif |
| 305 |
| 306 shared_bitmap_manager_.reset( |
| 307 new ChildSharedBitmapManager(thread_safe_sender())); |
| 304 } | 308 } |
| 305 | 309 |
| 306 ChildThread::~ChildThread() { | 310 ChildThread::~ChildThread() { |
| 307 #ifdef IPC_MESSAGE_LOG_ENABLED | 311 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 308 IPC::Logging::GetInstance()->SetIPCSender(NULL); | 312 IPC::Logging::GetInstance()->SetIPCSender(NULL); |
| 309 #endif | 313 #endif |
| 310 | 314 |
| 311 channel_->RemoveFilter(histogram_message_filter_.get()); | 315 channel_->RemoveFilter(histogram_message_filter_.get()); |
| 312 channel_->RemoveFilter(sync_message_filter_.get()); | 316 channel_->RemoveFilter(sync_message_filter_.get()); |
| 313 | 317 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // inflight that would addref it. | 536 // inflight that would addref it. |
| 533 Send(new ChildProcessHostMsg_ShutdownRequest); | 537 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 534 } | 538 } |
| 535 | 539 |
| 536 void ChildThread::EnsureConnected() { | 540 void ChildThread::EnsureConnected() { |
| 537 VLOG(0) << "ChildThread::EnsureConnected()"; | 541 VLOG(0) << "ChildThread::EnsureConnected()"; |
| 538 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 542 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 539 } | 543 } |
| 540 | 544 |
| 541 } // namespace content | 545 } // namespace content |
| OLD | NEW |