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 "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 sub_string = version_string.substr(begin); | 36 sub_string = version_string.substr(begin); |
37 std::vector<std::string> pieces; | 37 std::vector<std::string> pieces; |
38 base::SplitString(sub_string, '.', &pieces); | 38 base::SplitString(sub_string, '.', &pieces); |
39 if (pieces.size() < 2) | 39 if (pieces.size() < 2) |
40 return "0"; | 40 return "0"; |
41 return pieces[0] + "." + pieces[1]; | 41 return pieces[0] + "." + pieces[1]; |
42 } | 42 } |
43 | 43 |
44 } | 44 } |
45 | 45 |
46 namespace gpu_info_collector { | 46 namespace gpu { |
47 | 47 |
48 bool CollectContextGraphicsInfo(content::GPUInfo* gpu_info) { | 48 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) { |
49 return CollectBasicGraphicsInfo(gpu_info); | 49 return CollectBasicGraphicsInfo(gpu_info); |
50 } | 50 } |
51 | 51 |
52 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { | 52 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) { |
53 DCHECK(vendor_id && device_id); | 53 DCHECK(vendor_id && device_id); |
54 *vendor_id = 0; | 54 *vendor_id = 0; |
55 *device_id = 0; | 55 *device_id = 0; |
56 return kGpuIDNotSupported; | 56 return kGpuIDNotSupported; |
57 } | 57 } |
58 | 58 |
59 bool CollectBasicGraphicsInfo(content::GPUInfo* gpu_info) { | 59 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { |
60 gpu_info->can_lose_context = false; | 60 gpu_info->can_lose_context = false; |
61 gpu_info->finalized = true; | 61 gpu_info->finalized = true; |
62 | 62 |
63 gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); | 63 gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model(); |
64 | 64 |
65 // Create a short-lived context on the UI thread to collect the GL strings. | 65 // Create a short-lived context on the UI thread to collect the GL strings. |
66 return CollectGraphicsInfoGL(gpu_info); | 66 return CollectGraphicsInfoGL(gpu_info); |
67 } | 67 } |
68 | 68 |
69 bool CollectDriverInfoGL(content::GPUInfo* gpu_info) { | 69 bool CollectDriverInfoGL(GPUInfo* gpu_info) { |
70 gpu_info->driver_version = GetDriverVersionFromString( | 70 gpu_info->driver_version = GetDriverVersionFromString( |
71 gpu_info->gl_version_string); | 71 gpu_info->gl_version_string); |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, | 75 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
76 const content::GPUInfo& context_gpu_info) { | 76 const GPUInfo& context_gpu_info) { |
77 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 77 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
78 } | 78 } |
79 | 79 |
80 } // namespace gpu_info_collector | 80 } // namespace gpu |
OLD | NEW |