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 "components/tracing/child_trace_message_filter.h" |
15 #include "content/common/child_histogram_message_filter.h" | 15 #include "content/common/child_histogram_message_filter.h" |
16 #include "content/common/child_process.h" | 16 #include "content/common/child_process.h" |
17 #include "content/common/child_process_messages.h" | 17 #include "content/common/child_process_messages.h" |
| 18 #include "content/common/child_resource_message_filter.h" |
18 #include "content/common/fileapi/file_system_dispatcher.h" | 19 #include "content/common/fileapi/file_system_dispatcher.h" |
19 #include "content/common/quota_dispatcher.h" | 20 #include "content/common/quota_dispatcher.h" |
20 #include "content/common/resource_dispatcher.h" | 21 #include "content/common/resource_dispatcher.h" |
21 #include "content/common/socket_stream_dispatcher.h" | 22 #include "content/common/socket_stream_dispatcher.h" |
22 #include "content/common/thread_safe_sender.h" | 23 #include "content/common/thread_safe_sender.h" |
23 #include "content/public/common/content_switches.h" | 24 #include "content/public/common/content_switches.h" |
24 #include "ipc/ipc_logging.h" | 25 #include "ipc/ipc_logging.h" |
25 #include "ipc/ipc_switches.h" | 26 #include "ipc/ipc_switches.h" |
26 #include "ipc/ipc_sync_channel.h" | 27 #include "ipc/ipc_sync_channel.h" |
27 #include "ipc/ipc_sync_message_filter.h" | 28 #include "ipc/ipc_sync_message_filter.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 113 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
113 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 114 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
114 quota_dispatcher_.reset(new QuotaDispatcher()); | 115 quota_dispatcher_.reset(new QuotaDispatcher()); |
115 | 116 |
116 sync_message_filter_ = | 117 sync_message_filter_ = |
117 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 118 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
118 thread_safe_sender_ = | 119 thread_safe_sender_ = |
119 new ThreadSafeSender(base::MessageLoopProxy::current(), | 120 new ThreadSafeSender(base::MessageLoopProxy::current(), |
120 sync_message_filter_); | 121 sync_message_filter_); |
121 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 122 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
| 123 resource_message_filter_ = |
| 124 new ChildResourceMessageFilter(resource_dispatcher()); |
122 | 125 |
123 channel_->AddFilter(histogram_message_filter_.get()); | 126 channel_->AddFilter(histogram_message_filter_.get()); |
124 channel_->AddFilter(sync_message_filter_.get()); | 127 channel_->AddFilter(sync_message_filter_.get()); |
125 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 128 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
126 ChildProcess::current()->io_message_loop_proxy())); | 129 ChildProcess::current()->io_message_loop_proxy())); |
| 130 channel_->AddFilter(resource_message_filter_.get()); |
127 | 131 |
128 #if defined(OS_POSIX) | 132 #if defined(OS_POSIX) |
129 // Check that --process-type is specified so we don't do this in unit tests | 133 // Check that --process-type is specified so we don't do this in unit tests |
130 // and single-process mode. | 134 // and single-process mode. |
131 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 135 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
132 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 136 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
133 #endif | 137 #endif |
134 | 138 |
135 base::MessageLoop::current()->PostDelayedTask( | 139 base::MessageLoop::current()->PostDelayedTask( |
136 FROM_HERE, | 140 FROM_HERE, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // inflight that would addref it. | 352 // inflight that would addref it. |
349 Send(new ChildProcessHostMsg_ShutdownRequest); | 353 Send(new ChildProcessHostMsg_ShutdownRequest); |
350 } | 354 } |
351 | 355 |
352 void ChildThread::EnsureConnected() { | 356 void ChildThread::EnsureConnected() { |
353 LOG(INFO) << "ChildThread::EnsureConnected()"; | 357 LOG(INFO) << "ChildThread::EnsureConnected()"; |
354 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 358 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
355 } | 359 } |
356 | 360 |
357 } // namespace content | 361 } // namespace content |
OLD | NEW |