| 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/gpu/gpu_info_collector.h" | 5 #include "content/gpu/gpu_info_collector.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string_piece.h" | 13 #include "base/string_piece.h" |
| 13 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
| 14 #include "ui/gl/gl_bindings.h" | 15 #include "ui/gl/gl_bindings.h" |
| 15 #include "ui/gl/gl_context.h" | 16 #include "ui/gl/gl_context.h" |
| 16 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 17 #include "ui/gl/gl_interface.h" | 18 #include "ui/gl/gl_interface.h" |
| 18 | 19 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return (gpu_info->gpu.vendor_id && gpu_info->gpu.device_id); | 151 return (gpu_info->gpu.vendor_id && gpu_info->gpu.device_id); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace anonymous | 154 } // namespace anonymous |
| 154 | 155 |
| 155 namespace gpu_info_collector { | 156 namespace gpu_info_collector { |
| 156 | 157 |
| 157 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { | 158 bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { |
| 158 DCHECK(gpu_info); | 159 DCHECK(gpu_info); |
| 159 | 160 |
| 161 TRACE_EVENT0("gpu", "gpu_info_collector::CollectGraphicsInfo"); |
| 162 |
| 160 gpu_info->can_lose_context = | 163 gpu_info->can_lose_context = |
| 161 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); | 164 (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); |
| 162 gpu_info->finalized = true; | 165 gpu_info->finalized = true; |
| 163 return CollectGraphicsInfoGL(gpu_info); | 166 return CollectGraphicsInfoGL(gpu_info); |
| 164 } | 167 } |
| 165 | 168 |
| 166 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { | 169 bool CollectPreliminaryGraphicsInfo(content::GPUInfo* gpu_info) { |
| 167 DCHECK(gpu_info); | 170 DCHECK(gpu_info); |
| 168 | 171 |
| 169 return CollectPCIVideoCardInfo(gpu_info); | 172 return CollectPCIVideoCardInfo(gpu_info); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 182 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. | 185 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. |
| 183 std::string gl_version_string = gpu_info->gl_version_string; | 186 std::string gl_version_string = gpu_info->gl_version_string; |
| 184 size_t pos = gl_version_string.find_last_of('-'); | 187 size_t pos = gl_version_string.find_last_of('-'); |
| 185 if (pos == std::string::npos) | 188 if (pos == std::string::npos) |
| 186 return false; | 189 return false; |
| 187 gpu_info->driver_version = gl_version_string.substr(pos + 1); | 190 gpu_info->driver_version = gl_version_string.substr(pos + 1); |
| 188 return true; | 191 return true; |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace gpu_info_collector | 194 } // namespace gpu_info_collector |
| OLD | NEW |