OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "base/location.h" | 22 #include "base/location.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/metrics/field_trial.h" | 24 #include "base/metrics/field_trial.h" |
25 #include "base/metrics/histogram.h" | 25 #include "base/metrics/histogram.h" |
26 #include "base/process/process_handle.h" | 26 #include "base/process/process_handle.h" |
27 #include "base/profiler/scoped_tracker.h" | 27 #include "base/profiler/scoped_tracker.h" |
28 #include "base/rand_util.h" | 28 #include "base/rand_util.h" |
29 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
30 #include "base/stl_util.h" | 30 #include "base/stl_util.h" |
31 #include "base/strings/string_number_conversions.h" | 31 #include "base/strings/string_number_conversions.h" |
32 #include "base/strings/string_util.h" | |
33 #include "base/supports_user_data.h" | 32 #include "base/supports_user_data.h" |
34 #include "base/sys_info.h" | 33 #include "base/sys_info.h" |
35 #include "base/threading/thread.h" | 34 #include "base/threading/thread.h" |
36 #include "base/threading/thread_restrictions.h" | 35 #include "base/threading/thread_restrictions.h" |
37 #include "base/trace_event/trace_event.h" | 36 #include "base/trace_event/trace_event.h" |
38 #include "base/tracked_objects.h" | 37 #include "base/tracked_objects.h" |
39 #include "cc/base/switches.h" | 38 #include "cc/base/switches.h" |
40 #include "components/tracing/tracing_switches.h" | 39 #include "components/tracing/tracing_switches.h" |
41 #include "content/browser/appcache/appcache_dispatcher_host.h" | 40 #include "content/browser/appcache/appcache_dispatcher_host.h" |
42 #include "content/browser/appcache/chrome_appcache_service.h" | 41 #include "content/browser/appcache/chrome_appcache_service.h" |
(...skipping 2264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2307 // The cbstext.dll loads as a global GetMessage hook in the browser process | 2306 // The cbstext.dll loads as a global GetMessage hook in the browser process |
2308 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a | 2307 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a |
2309 // background thread. If the UI thread invokes this API just when it is | 2308 // background thread. If the UI thread invokes this API just when it is |
2310 // intercepted the stack is messed up on return from the interceptor | 2309 // intercepted the stack is messed up on return from the interceptor |
2311 // which causes random crashes in the browser process. Our hack for now | 2310 // which causes random crashes in the browser process. Our hack for now |
2312 // is to not invoke the SetPriorityClass API if the dll is loaded. | 2311 // is to not invoke the SetPriorityClass API if the dll is loaded. |
2313 if (GetModuleHandle(L"cbstext.dll")) | 2312 if (GetModuleHandle(L"cbstext.dll")) |
2314 return; | 2313 return; |
2315 #endif // OS_WIN | 2314 #endif // OS_WIN |
2316 | 2315 |
2317 #if defined(OS_WIN) | |
2318 // Same as below, but bound to an experiment (http://crbug.com/458594 ). | |
2319 // Enabled by default in the absence of field trials to get coverage on the | |
2320 // perf waterfall. | |
2321 base::FieldTrial* trial = | |
2322 base::FieldTrialList::Find("BackgroundRendererProcesses"); | |
2323 if (!trial || !base::StartsWith(trial->group_name(), "Disallow", | |
2324 base::CompareCase::SENSITIVE)) { | |
2325 child_process_launcher_->SetProcessBackgrounded(backgrounded); | |
2326 } | |
2327 #else | |
2328 // Control the background state from the browser process, otherwise the task | 2316 // Control the background state from the browser process, otherwise the task |
2329 // telling the renderer to "unbackground" itself may be preempted by other | 2317 // telling the renderer to "unbackground" itself may be preempted by other |
2330 // tasks executing at lowered priority ahead of it or simply by not being | 2318 // tasks executing at lowered priority ahead of it or simply by not being |
2331 // swiftly scheduled by the OS per the low process priority | 2319 // swiftly scheduled by the OS per the low process priority |
2332 // (http://crbug.com/398103). | 2320 // (http://crbug.com/398103). |
2333 child_process_launcher_->SetProcessBackgrounded(backgrounded); | 2321 child_process_launcher_->SetProcessBackgrounded(backgrounded); |
2334 #endif // OS_WIN | |
2335 | 2322 |
2336 // Notify the child process of background state. | 2323 // Notify the child process of background state. |
2337 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); | 2324 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); |
2338 } | 2325 } |
2339 | 2326 |
2340 void RenderProcessHostImpl::OnProcessLaunched() { | 2327 void RenderProcessHostImpl::OnProcessLaunched() { |
2341 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841 | 2328 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/465841 |
2342 // is fixed. | 2329 // is fixed. |
2343 tracked_objects::ScopedTracker tracking_profile1( | 2330 tracked_objects::ScopedTracker tracking_profile1( |
2344 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2331 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 void RenderProcessHostImpl::GetAudioOutputControllers( | 2549 void RenderProcessHostImpl::GetAudioOutputControllers( |
2563 const GetAudioOutputControllersCallback& callback) const { | 2550 const GetAudioOutputControllersCallback& callback) const { |
2564 audio_renderer_host()->GetOutputControllers(callback); | 2551 audio_renderer_host()->GetOutputControllers(callback); |
2565 } | 2552 } |
2566 | 2553 |
2567 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2554 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2568 return bluetooth_dispatcher_host_.get(); | 2555 return bluetooth_dispatcher_host_.get(); |
2569 } | 2556 } |
2570 | 2557 |
2571 } // namespace content | 2558 } // namespace content |
OLD | NEW |