Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: content/gpu/gpu_info_collector_linux.cc

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <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"
11 #include "base/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/string_piece.h" 16 #include "base/string_piece.h"
17 #include "base/string_split.h" 17 #include "base/string_split.h"
18 #include "base/string_tokenizer.h"
19 #include "base/string_util.h" 18 #include "base/string_util.h"
19 #include "base/strings/string_tokenizer.h"
20 #include "library_loaders/libpci.h" 20 #include "library_loaders/libpci.h"
21 #include "third_party/libXNVCtrl/NVCtrl.h" 21 #include "third_party/libXNVCtrl/NVCtrl.h"
22 #include "third_party/libXNVCtrl/NVCtrlLib.h" 22 #include "third_party/libXNVCtrl/NVCtrlLib.h"
23 #include "ui/gl/gl_bindings.h" 23 #include "ui/gl/gl_bindings.h"
24 #include "ui/gl/gl_context.h" 24 #include "ui/gl/gl_context.h"
25 #include "ui/gl/gl_implementation.h" 25 #include "ui/gl/gl_implementation.h"
26 #include "ui/gl/gl_surface.h" 26 #include "ui/gl/gl_surface.h"
27 #include "ui/gl/gl_switches.h" 27 #include "ui/gl/gl_switches.h"
28 28
29 namespace { 29 namespace {
(...skipping 11 matching lines...) Expand all
41 // Return empty string on failing. 41 // Return empty string on failing.
42 std::string CollectDriverVersionATI() { 42 std::string CollectDriverVersionATI() {
43 const FilePath::CharType kATIFileName[] = 43 const FilePath::CharType kATIFileName[] =
44 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); 44 FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default");
45 FilePath ati_file_path(kATIFileName); 45 FilePath ati_file_path(kATIFileName);
46 if (!file_util::PathExists(ati_file_path)) 46 if (!file_util::PathExists(ati_file_path))
47 return std::string(); 47 return std::string();
48 std::string contents; 48 std::string contents;
49 if (!file_util::ReadFileToString(ati_file_path, &contents)) 49 if (!file_util::ReadFileToString(ati_file_path, &contents))
50 return std::string(); 50 return std::string();
51 StringTokenizer t(contents, "\r\n"); 51 base::StringTokenizer t(contents, "\r\n");
52 while (t.GetNext()) { 52 while (t.GetNext()) {
53 std::string line = t.token(); 53 std::string line = t.token();
54 if (StartsWithASCII(line, "ReleaseVersion=", true)) { 54 if (StartsWithASCII(line, "ReleaseVersion=", true)) {
55 size_t begin = line.find_first_of("0123456789"); 55 size_t begin = line.find_first_of("0123456789");
56 if (begin != std::string::npos) { 56 if (begin != std::string::npos) {
57 size_t end = line.find_first_not_of("0123456789.", begin); 57 size_t end = line.find_first_not_of("0123456789.", begin);
58 if (end == std::string::npos) 58 if (end == std::string::npos)
59 return line.substr(begin); 59 return line.substr(begin);
60 else 60 else
61 return line.substr(begin, end - begin); 61 return line.substr(begin, end - begin);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 gpu_info->driver_version = driver_version; 279 gpu_info->driver_version = driver_version;
280 return true; 280 return true;
281 } 281 }
282 282
283 void MergeGPUInfo(content::GPUInfo* basic_gpu_info, 283 void MergeGPUInfo(content::GPUInfo* basic_gpu_info,
284 const content::GPUInfo& context_gpu_info) { 284 const content::GPUInfo& context_gpu_info) {
285 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 285 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
286 } 286 }
287 287
288 } // namespace gpu_info_collector 288 } // namespace gpu_info_collector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698