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 <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Scan /etc/ati/amdpcsdb.default for "ReleaseVersion". | 42 // Scan /etc/ati/amdpcsdb.default for "ReleaseVersion". |
43 // Return empty string on failing. | 43 // Return empty string on failing. |
44 std::string CollectDriverVersionATI() { | 44 std::string CollectDriverVersionATI() { |
45 const base::FilePath::CharType kATIFileName[] = | 45 const base::FilePath::CharType kATIFileName[] = |
46 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); | 46 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); |
47 base::FilePath ati_file_path(kATIFileName); | 47 base::FilePath ati_file_path(kATIFileName); |
48 if (!base::PathExists(ati_file_path)) | 48 if (!base::PathExists(ati_file_path)) |
49 return std::string(); | 49 return std::string(); |
50 std::string contents; | 50 std::string contents; |
51 if (!file_util::ReadFileToString(ati_file_path, &contents)) | 51 if (!base::ReadFileToString(ati_file_path, &contents)) |
52 return std::string(); | 52 return std::string(); |
53 base::StringTokenizer t(contents, "\r\n"); | 53 base::StringTokenizer t(contents, "\r\n"); |
54 while (t.GetNext()) { | 54 while (t.GetNext()) { |
55 std::string line = t.token(); | 55 std::string line = t.token(); |
56 if (StartsWithASCII(line, "ReleaseVersion=", true)) { | 56 if (StartsWithASCII(line, "ReleaseVersion=", true)) { |
57 size_t begin = line.find_first_of("0123456789"); | 57 size_t begin = line.find_first_of("0123456789"); |
58 if (begin != std::string::npos) { | 58 if (begin != std::string::npos) { |
59 size_t end = line.find_first_not_of("0123456789.", begin); | 59 size_t end = line.find_first_not_of("0123456789.", begin); |
60 if (end == std::string::npos) | 60 if (end == std::string::npos) |
61 return line.substr(begin); | 61 return line.substr(begin); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 gpu_info->driver_version = driver_version; | 265 gpu_info->driver_version = driver_version; |
266 return true; | 266 return true; |
267 } | 267 } |
268 | 268 |
269 void MergeGPUInfo(GPUInfo* basic_gpu_info, | 269 void MergeGPUInfo(GPUInfo* basic_gpu_info, |
270 const GPUInfo& context_gpu_info) { | 270 const GPUInfo& context_gpu_info) { |
271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); | 271 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); |
272 } | 272 } |
273 | 273 |
274 } // namespace gpu | 274 } // namespace gpu |
OLD | NEW |