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/browser/browser_child_process_host_impl.h" | 5 #include "content/browser/browser_child_process_host_impl.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
17 #include "content/browser/histogram_message_filter.h" | 17 #include "content/browser/histogram_message_filter.h" |
18 #include "content/browser/loader/resource_message_filter.h" | 18 #include "content/browser/loader/resource_message_filter.h" |
| 19 #include "content/browser/process_resource_impl.h" |
19 #include "content/browser/profiler_message_filter.h" | 20 #include "content/browser/profiler_message_filter.h" |
20 #include "content/browser/tracing/trace_message_filter.h" | 21 #include "content/browser/tracing/trace_message_filter.h" |
21 #include "content/common/child_process_host_impl.h" | 22 #include "content/common/child_process_host_impl.h" |
22 #include "content/public/browser/browser_child_process_host_delegate.h" | 23 #include "content/public/browser/browser_child_process_host_delegate.h" |
23 #include "content/public/browser/browser_child_process_observer.h" | 24 #include "content/public/browser/browser_child_process_observer.h" |
24 #include "content/public/browser/browser_thread.h" | 25 #include "content/public/browser/browser_thread.h" |
25 #include "content/public/browser/child_process_data.h" | 26 #include "content/public/browser/child_process_data.h" |
26 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
27 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/process_type.h" | 29 #include "content/public/common/process_type.h" |
29 #include "content/public/common/result_codes.h" | 30 #include "content/public/common/result_codes.h" |
| 31 #include "content/public/common/service_registry.h" |
30 | 32 |
31 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
32 #include "content/browser/mach_broker_mac.h" | 34 #include "content/browser/mach_broker_mac.h" |
33 #endif | 35 #endif |
34 | 36 |
35 namespace content { | 37 namespace content { |
36 namespace { | 38 namespace { |
37 | 39 |
38 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> | 40 static base::LazyInstance<BrowserChildProcessHostImpl::BrowserChildProcessList> |
39 g_child_process_list = LAZY_INSTANCE_INITIALIZER; | 41 g_child_process_list = LAZY_INSTANCE_INITIALIZER; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void BrowserChildProcessHostImpl::SetTerminateChildOnShutdown( | 198 void BrowserChildProcessHostImpl::SetTerminateChildOnShutdown( |
197 bool terminate_on_shutdown) { | 199 bool terminate_on_shutdown) { |
198 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
199 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); | 201 child_process_->SetTerminateChildOnShutdown(terminate_on_shutdown); |
200 } | 202 } |
201 | 203 |
202 void BrowserChildProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { | 204 void BrowserChildProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { |
203 child_process_host_->AddFilter(filter->GetFilter()); | 205 child_process_host_->AddFilter(filter->GetFilter()); |
204 } | 206 } |
205 | 207 |
| 208 void BrowserChildProcessHostImpl::SetServiceRegistry( |
| 209 ServiceRegistry* registry) { |
| 210 ProcessResourceServicePtr service; |
| 211 registry->ConnectToRemoteService(&service); |
| 212 data_.process_resource = new ProcessResourceImpl(service.Pass()); |
| 213 } |
| 214 |
206 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( | 215 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( |
207 const ChildProcessData& data) { | 216 const ChildProcessData& data) { |
208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 217 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
209 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 218 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
210 BrowserChildProcessInstanceCreated(data)); | 219 BrowserChildProcessInstanceCreated(data)); |
211 } | 220 } |
212 | 221 |
213 void BrowserChildProcessHostImpl::HistogramBadMessageTerminated( | 222 void BrowserChildProcessHostImpl::HistogramBadMessageTerminated( |
214 int process_type) { | 223 int process_type) { |
215 UMA_HISTOGRAM_ENUMERATION("ChildProcess.BadMessgeTerminated", process_type, | 224 UMA_HISTOGRAM_ENUMERATION("ChildProcess.BadMessgeTerminated", process_type, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 348 |
340 #if defined(OS_WIN) | 349 #if defined(OS_WIN) |
341 | 350 |
342 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 351 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
343 OnChildDisconnected(); | 352 OnChildDisconnected(); |
344 } | 353 } |
345 | 354 |
346 #endif | 355 #endif |
347 | 356 |
348 } // namespace content | 357 } // namespace content |
OLD | NEW |