| 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/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "content/browser/histogram_message_filter.h" | 19 #include "content/browser/histogram_message_filter.h" |
| 20 #include "content/browser/loader/resource_message_filter.h" | 20 #include "content/browser/loader/resource_message_filter.h" |
| 21 #include "content/browser/process_resource_usage_impl.h" |
| 21 #include "content/browser/profiler_message_filter.h" | 22 #include "content/browser/profiler_message_filter.h" |
| 22 #include "content/browser/tracing/trace_message_filter.h" | 23 #include "content/browser/tracing/trace_message_filter.h" |
| 23 #include "content/common/child_process_host_impl.h" | 24 #include "content/common/child_process_host_impl.h" |
| 24 #include "content/public/browser/browser_child_process_host_delegate.h" | 25 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 25 #include "content/public/browser/browser_child_process_observer.h" | 26 #include "content/public/browser/browser_child_process_observer.h" |
| 26 #include "content/public/browser/browser_thread.h" | 27 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/child_process_data.h" | 28 #include "content/public/browser/child_process_data.h" |
| 28 #include "content/public/browser/content_browser_client.h" | 29 #include "content/public/browser/content_browser_client.h" |
| 29 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 30 #include "content/public/common/process_type.h" | 31 #include "content/public/common/process_type.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 } | 195 } |
| 195 | 196 |
| 196 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { | 197 void BrowserChildProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| 197 child_process_->SetProcessBackgrounded(backgrounded); | 198 child_process_->SetProcessBackgrounded(backgrounded); |
| 198 } | 199 } |
| 199 | 200 |
| 200 void BrowserChildProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { | 201 void BrowserChildProcessHostImpl::AddFilter(BrowserMessageFilter* filter) { |
| 201 child_process_host_->AddFilter(filter->GetFilter()); | 202 child_process_host_->AddFilter(filter->GetFilter()); |
| 202 } | 203 } |
| 203 | 204 |
| 205 void BrowserChildProcessHostImpl::SetResourceUsageReporter( |
| 206 ResourceUsageReporterPtr service) { |
| 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 208 data_.process_resource_usage = new ProcessResourceUsageImpl(service.Pass()); |
| 209 } |
| 210 |
| 204 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( | 211 void BrowserChildProcessHostImpl::NotifyProcessInstanceCreated( |
| 205 const ChildProcessData& data) { | 212 const ChildProcessData& data) { |
| 206 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 213 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 207 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), | 214 FOR_EACH_OBSERVER(BrowserChildProcessObserver, g_observers.Get(), |
| 208 BrowserChildProcessInstanceCreated(data)); | 215 BrowserChildProcessInstanceCreated(data)); |
| 209 } | 216 } |
| 210 | 217 |
| 211 void BrowserChildProcessHostImpl::HistogramBadMessageTerminated( | 218 void BrowserChildProcessHostImpl::HistogramBadMessageTerminated( |
| 212 int process_type) { | 219 int process_type) { |
| 213 UMA_HISTOGRAM_ENUMERATION("ChildProcess.BadMessgeTerminated", process_type, | 220 UMA_HISTOGRAM_ENUMERATION("ChildProcess.BadMessgeTerminated", process_type, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 355 |
| 349 #if defined(OS_WIN) | 356 #if defined(OS_WIN) |
| 350 | 357 |
| 351 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 358 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 352 OnChildDisconnected(); | 359 OnChildDisconnected(); |
| 353 } | 360 } |
| 354 | 361 |
| 355 #endif | 362 #endif |
| 356 | 363 |
| 357 } // namespace content | 364 } // namespace content |
| OLD | NEW |