Chromium Code Reviews| 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 "gpu/config/gpu_info_collector.h" | 5 #include "gpu/config/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 18 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 20 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 22 #include "gpu/config/gpu_switches.h" | |
| 21 #include "ui/gl/gl_bindings.h" | 23 #include "ui/gl/gl_bindings.h" |
| 22 #include "ui/gl/gl_context.h" | 24 #include "ui/gl/gl_context.h" |
| 23 #include "ui/gl/gl_implementation.h" | 25 #include "ui/gl/gl_implementation.h" |
| 24 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| 25 #include "ui/gl/gl_version_info.h" | 27 #include "ui/gl/gl_version_info.h" |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { | 31 scoped_refptr<gfx::GLSurface> InitializeGLSurface() { |
| 30 scoped_refptr<gfx::GLSurface> surface( | 32 scoped_refptr<gfx::GLSurface> surface( |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 return; | 265 return; |
| 264 } | 266 } |
| 265 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { | 267 for (size_t ii = 0; ii < gpu_info->secondary_gpus.size(); ++ii) { |
| 266 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { | 268 if (active_vendor_id == gpu_info->secondary_gpus[ii].vendor_id) { |
| 267 gpu_info->secondary_gpus[ii].active = true; | 269 gpu_info->secondary_gpus[ii].active = true; |
| 268 return; | 270 return; |
| 269 } | 271 } |
| 270 } | 272 } |
| 271 } | 273 } |
| 272 | 274 |
| 275 void ParseTestingIds(uint32_t* vendor_id, uint32_t* device_id) { | |
| 276 DCHECK(vendor_id); | |
| 277 DCHECK(device_id); | |
|
Zhenyao Mo
2016/01/29 22:40:35
Set them to 0 by default.
| |
| 278 | |
| 279 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 280 | |
| 281 if (command_line->HasSwitch(switches::kGpuTestingVendorId)) | |
| 282 base::HexStringToUInt( | |
| 283 command_line->GetSwitchValueASCII(switches::kGpuTestingVendorId), | |
| 284 vendor_id); | |
| 285 | |
| 286 if (command_line->HasSwitch(switches::kGpuTestingDeviceId)) | |
| 287 base::HexStringToUInt( | |
| 288 command_line->GetSwitchValueASCII(switches::kGpuTestingDeviceId), | |
| 289 device_id); | |
| 290 } | |
| 291 | |
| 273 } // namespace gpu | 292 } // namespace gpu |
| 274 | 293 |
| OLD | NEW |