| 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/common/child_thread.h" | 5 #include "content/common/child_thread.h" |
| 6 | 6 |
| 7 #include "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| 11 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
| 14 #include "components/tracing/child_trace_message_filter.h" |
| 14 #include "content/common/child_histogram_message_filter.h" | 15 #include "content/common/child_histogram_message_filter.h" |
| 15 #include "content/common/child_process.h" | 16 #include "content/common/child_process.h" |
| 16 #include "content/common/child_process_messages.h" | 17 #include "content/common/child_process_messages.h" |
| 17 #include "content/common/fileapi/file_system_dispatcher.h" | 18 #include "content/common/fileapi/file_system_dispatcher.h" |
| 18 #include "content/common/quota_dispatcher.h" | 19 #include "content/common/quota_dispatcher.h" |
| 19 #include "content/common/resource_dispatcher.h" | 20 #include "content/common/resource_dispatcher.h" |
| 20 #include "content/common/socket_stream_dispatcher.h" | 21 #include "content/common/socket_stream_dispatcher.h" |
| 21 #include "content/components/tracing/child_trace_message_filter.h" | |
| 22 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
| 23 #include "ipc/ipc_logging.h" | 23 #include "ipc/ipc_logging.h" |
| 24 #include "ipc/ipc_switches.h" | 24 #include "ipc/ipc_switches.h" |
| 25 #include "ipc/ipc_sync_channel.h" | 25 #include "ipc/ipc_sync_channel.h" |
| 26 #include "ipc/ipc_sync_message_filter.h" | 26 #include "ipc/ipc_sync_message_filter.h" |
| 27 #include "webkit/glue/webkit_glue.h" | 27 #include "webkit/glue/webkit_glue.h" |
| 28 | 28 |
| 29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 30 #include "content/common/handle_enumerator_win.h" | 30 #include "content/common/handle_enumerator_win.h" |
| 31 #endif | 31 #endif |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 108 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
| 109 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 109 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
| 110 quota_dispatcher_.reset(new QuotaDispatcher()); | 110 quota_dispatcher_.reset(new QuotaDispatcher()); |
| 111 | 111 |
| 112 sync_message_filter_ = | 112 sync_message_filter_ = |
| 113 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 113 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
| 114 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 114 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
| 115 | 115 |
| 116 channel_->AddFilter(histogram_message_filter_.get()); | 116 channel_->AddFilter(histogram_message_filter_.get()); |
| 117 channel_->AddFilter(sync_message_filter_.get()); | 117 channel_->AddFilter(sync_message_filter_.get()); |
| 118 channel_->AddFilter(new ChildTraceMessageFilter( | 118 channel_->AddFilter(new components::ChildTraceMessageFilter( |
| 119 ChildProcess::current()->io_message_loop_proxy())); | 119 ChildProcess::current()->io_message_loop_proxy())); |
| 120 | 120 |
| 121 #if defined(OS_POSIX) | 121 #if defined(OS_POSIX) |
| 122 // Check that --process-type is specified so we don't do this in unit tests | 122 // Check that --process-type is specified so we don't do this in unit tests |
| 123 // and single-process mode. | 123 // and single-process mode. |
| 124 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 124 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 125 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 125 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| 126 #endif | 126 #endif |
| 127 | 127 |
| 128 MessageLoop::current()->PostDelayedTask( | 128 MessageLoop::current()->PostDelayedTask( |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 // inflight that would addref it. | 352 // inflight that would addref it. |
| 353 Send(new ChildProcessHostMsg_ShutdownRequest); | 353 Send(new ChildProcessHostMsg_ShutdownRequest); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void ChildThread::EnsureConnected() { | 356 void ChildThread::EnsureConnected() { |
| 357 LOG(INFO) << "ChildThread::EnsureConnected()"; | 357 LOG(INFO) << "ChildThread::EnsureConnected()"; |
| 358 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 358 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
| 359 } | 359 } |
| 360 | 360 |
| 361 } // namespace content | 361 } // namespace content |
| OLD | NEW |