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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); | 110 socket_stream_dispatcher_.reset(new SocketStreamDispatcher()); |
110 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 111 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
111 quota_dispatcher_.reset(new QuotaDispatcher()); | 112 quota_dispatcher_.reset(new QuotaDispatcher()); |
112 | 113 |
113 sync_message_filter_ = | 114 sync_message_filter_ = |
114 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); | 115 new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent()); |
115 thread_safe_sender_ = | 116 thread_safe_sender_ = |
116 new ThreadSafeSender(base::MessageLoopProxy::current(), | 117 new ThreadSafeSender(base::MessageLoopProxy::current(), |
117 sync_message_filter_); | 118 sync_message_filter_); |
118 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 119 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
| 120 resource_message_filter_ = |
| 121 new ChildResourceMessageFilter(resource_dispatcher()); |
119 | 122 |
120 channel_->AddFilter(histogram_message_filter_.get()); | 123 channel_->AddFilter(histogram_message_filter_.get()); |
121 channel_->AddFilter(sync_message_filter_.get()); | 124 channel_->AddFilter(sync_message_filter_.get()); |
122 channel_->AddFilter(new components::ChildTraceMessageFilter( | 125 channel_->AddFilter(new components::ChildTraceMessageFilter( |
123 ChildProcess::current()->io_message_loop_proxy())); | 126 ChildProcess::current()->io_message_loop_proxy())); |
| 127 channel_->AddFilter(resource_message_filter_.get()); |
124 | 128 |
125 #if defined(OS_POSIX) | 129 #if defined(OS_POSIX) |
126 // Check that --process-type is specified so we don't do this in unit tests | 130 // Check that --process-type is specified so we don't do this in unit tests |
127 // and single-process mode. | 131 // and single-process mode. |
128 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 132 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
129 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 133 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
130 #endif | 134 #endif |
131 | 135 |
132 MessageLoop::current()->PostDelayedTask( | 136 MessageLoop::current()->PostDelayedTask( |
133 FROM_HERE, | 137 FROM_HERE, |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // inflight that would addref it. | 355 // inflight that would addref it. |
352 Send(new ChildProcessHostMsg_ShutdownRequest); | 356 Send(new ChildProcessHostMsg_ShutdownRequest); |
353 } | 357 } |
354 | 358 |
355 void ChildThread::EnsureConnected() { | 359 void ChildThread::EnsureConnected() { |
356 LOG(INFO) << "ChildThread::EnsureConnected()"; | 360 LOG(INFO) << "ChildThread::EnsureConnected()"; |
357 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); | 361 base::KillProcess(base::GetCurrentProcessHandle(), 0, false); |
358 } | 362 } |
359 | 363 |
360 } // namespace content | 364 } // namespace content |
OLD | NEW |