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" | |
21 #include "ui/gl/gl_implementation.h" | 20 #include "ui/gl/gl_implementation.h" |
22 #include "ui/gl/gl_switches.h" | 21 #include "ui/gl/gl_switches.h" |
23 #include "ui/gl/init/gl_factory.h" | 22 #include "ui/gl/init/gl_factory.h" |
24 | 23 |
25 namespace gpu { | 24 namespace gpu { |
26 | 25 |
27 namespace { | 26 namespace { |
28 | 27 |
29 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, | 28 void GetGpuInfoFromCommandLine(gpu::GPUInfo& gpu_info, |
30 const base::CommandLine& command_line) { | 29 const base::CommandLine& command_line) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(&workarounds, | 120 gpu::GpuDriverBugList::AppendWorkaroundsFromCommandLine(&workarounds, |
122 command_line); | 121 command_line); |
123 gpu::InitializeDualGpusIfSupported(workarounds); | 122 gpu::InitializeDualGpusIfSupported(workarounds); |
124 } | 123 } |
125 | 124 |
126 // In addition to disabling the watchdog if the command line switch is | 125 // In addition to disabling the watchdog if the command line switch is |
127 // present, disable the watchdog on valgrind because the code is expected | 126 // present, disable the watchdog on valgrind because the code is expected |
128 // to run slowly in that case. | 127 // to run slowly in that case. |
129 bool enable_watchdog = | 128 bool enable_watchdog = |
130 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && | 129 !command_line.HasSwitch(switches::kDisableGpuWatchdog) && |
131 !command_line.HasSwitch(switches::kHeadless) && | |
132 !RunningOnValgrind(); | 130 !RunningOnValgrind(); |
133 | 131 |
134 // Disable the watchdog in debug builds because they tend to only be run by | 132 // Disable the watchdog in debug builds because they tend to only be run by |
135 // developers who will not appreciate the watchdog killing the GPU process. | 133 // developers who will not appreciate the watchdog killing the GPU process. |
136 #ifndef NDEBUG | 134 #ifndef NDEBUG |
137 enable_watchdog = false; | 135 enable_watchdog = false; |
138 #endif | 136 #endif |
139 | 137 |
140 bool delayed_watchdog_enable = false; | 138 bool delayed_watchdog_enable = false; |
141 | 139 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); | 230 watchdog_thread_ = gpu::GpuWatchdogThread::Create(); |
233 } | 231 } |
234 | 232 |
235 if (!gpu_info_.sandboxed) | 233 if (!gpu_info_.sandboxed) |
236 gpu_info_.sandboxed = | 234 gpu_info_.sandboxed = |
237 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); | 235 sandbox_helper_->EnsureSandboxInitialized(watchdog_thread_.get()); |
238 return true; | 236 return true; |
239 } | 237 } |
240 | 238 |
241 } // namespace gpu | 239 } // namespace gpu |
OLD | NEW |