OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "gpu/ipc/service/gpu_init.h" | 5 #include "gpu/ipc/service/gpu_init.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 10 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
11 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "gpu/command_buffer/service/gpu_switches.h" | 13 #include "gpu/command_buffer/service/gpu_switches.h" |
14 #include "gpu/config/gpu_driver_bug_list.h" | 14 #include "gpu/config/gpu_driver_bug_list.h" |
15 #include "gpu/config/gpu_info_collector.h" | 15 #include "gpu/config/gpu_info_collector.h" |
16 #include "gpu/config/gpu_switches.h" | 16 #include "gpu/config/gpu_switches.h" |
17 #include "gpu/config/gpu_util.h" | 17 #include "gpu/config/gpu_util.h" |
18 #include "gpu/ipc/service/gpu_watchdog_thread.h" | 18 #include "gpu/ipc/service/gpu_watchdog_thread.h" |
19 #include "gpu/ipc/service/switches.h" | 19 #include "gpu/ipc/service/switches.h" |
| 20 #include "ui/gfx/switches.h" |
20 #include "ui/gl/gl_implementation.h" | 21 #include "ui/gl/gl_implementation.h" |
21 #include "ui/gl/gl_switches.h" | 22 #include "ui/gl/gl_switches.h" |
22 #include "ui/gl/init/gl_factory.h" | 23 #include "ui/gl/init/gl_factory.h" |
23 | 24 |
24 namespace gpu { | 25 namespace gpu { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, | 29 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, |
29 const base::CommandLine& command_line) { | 30 const base::CommandLine& command_line) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(&workarounds, | 121 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(&workarounds, |
121 command_line); | 122 command_line); |
122 gpu::InitializeDualGpusIfSupported(workarounds); | 123 gpu::InitializeDualGpusIfSupported(workarounds); |
123 } | 124 } |
124 | 125 |
125 // In addition to disabling the watchdog if the command line switch is | 126 // In addition to disabling the watchdog if the command line switch is |
126 // present, disable the watchdog on valgrind because the code is expected | 127 // present, disable the watchdog on valgrind because the code is expected |
127 // to run slowly in that case. | 128 // to run slowly in that case. |
128 bool enable_watchdog = | 129 bool enable_watchdog = |
129 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && | 130 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && |
| 131 !command_line.HasSwitch(switches::kHeadless) && |
130 !RunningOnValgrind(); | 132 !RunningOnValgrind(); |
131 | 133 |
132 // Disable the watchdog in debug builds because they tend to only be run by | 134 // Disable the watchdog in debug builds because they tend to only be run by |
133 // developers who will not appreciate the watchdog killing the GPU process. | 135 // developers who will not appreciate the watchdog killing the GPU process. |
134 #ifndef NDEBUG | 136 #ifndef NDEBUG |
135 enable_watchdog = false; | 137 enable_watchdog = false; |
136 #endif | 138 #endif |
137 | 139 |
138 bool delayed_watchdog_enable = false; | 140 bool delayed_watchdog_enable = false; |
139 | 141 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); | 232 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
231 } | 233 } |
232 | 234 |
233 if (!gpu_info_.sandboxed) | 235 if (!gpu_info_.sandboxed) |
234 gpu_info_.sandboxed = | 236 gpu_info_.sandboxed = |
235 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 237 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
236 return true; | 238 return true; |
237 } | 239 } |
238 | 240 |
239 } // namespace gpu | 241 } // namespace gpu |
OLD | NEW |