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 "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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 begin = version_string.find_first_of("0123456789", begin); | 27 begin = version_string.find_first_of("0123456789", begin); |
28 if (begin == std::string::npos) | 28 if (begin == std::string::npos) |
29 return std::make_pair("", std::string::npos); | 29 return std::make_pair("", std::string::npos); |
30 | 30 |
31 size_t end = version_string.find_first_not_of("01234567890.", begin); | 31 size_t end = version_string.find_first_not_of("01234567890.", begin); |
32 std::string sub_string; | 32 std::string sub_string; |
33 if (end != std::string::npos) | 33 if (end != std::string::npos) |
34 sub_string = version_string.substr(begin, end - begin); | 34 sub_string = version_string.substr(begin, end - begin); |
35 else | 35 else |
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 = base::SplitString( |
38 base::SplitString(sub_string, '.', &pieces); | 38 sub_string, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
39 if (pieces.size() >= 2) | 39 if (pieces.size() >= 2) |
40 return std::make_pair(pieces[0] + "." + pieces[1], end); | 40 return std::make_pair(pieces[0] + "." + pieces[1], end); |
41 else | 41 else |
42 return std::make_pair("", end); | 42 return std::make_pair("", end); |
43 } | 43 } |
44 | 44 |
45 std::string GetDriverVersionFromString(const std::string& version_string) { | 45 std::string GetDriverVersionFromString(const std::string& version_string) { |
46 // We expect that android GL_VERSION strings will be of a form | 46 // We expect that android GL_VERSION strings will be of a form |
47 // similar to: "OpenGL ES 2.0 V@6.0 AU@ (CL@2946718)" where the | 47 // similar to: "OpenGL ES 2.0 V@6.0 AU@ (CL@2946718)" where the |
48 // first match to [0-9][0-9.]* is the OpenGL ES version number, and | 48 // first match to [0-9][0-9.]* is the OpenGL ES version number, and |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 gpu_info->gpu.device_string = gpu_info->gl_renderer; | 280 gpu_info->gpu.device_string = gpu_info->gl_renderer; |
281 return kCollectInfoSuccess; | 281 return kCollectInfoSuccess; |
282 } | 282 } |
283 | 283 |
284 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 284 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
285 const GPUInfo& context_gpu_info) { | 285 const GPUInfo& context_gpu_info) { |
286 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 286 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
287 } | 287 } |
288 | 288 |
289 } // namespace gpu | 289 } // namespace gpu |
OLD | NEW |