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

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

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 return context; 48 return context;
49 } 49 }
50 50
51 std::string GetGLString(unsigned int pname) { 51 std::string GetGLString(unsigned int pname) {
52 const char* gl_string = 52 const char* gl_string =
53 reinterpret_cast<const char*>(glGetString(pname)); 53 reinterpret_cast<const char*>(glGetString(pname));
54 if (gl_string) 54 if (gl_string)
55 return std::string(gl_string); 55 return std::string(gl_string);
56 return ""; 56 return std::string();
57 } 57 }
58 58
59 // Return a version string in the format of "major.minor". 59 // Return a version string in the format of "major.minor".
60 std::string GetVersionFromString(const std::string& version_string) { 60 std::string GetVersionFromString(const std::string& version_string) {
61 size_t begin = version_string.find_first_of("0123456789"); 61 size_t begin = version_string.find_first_of("0123456789");
62 if (begin != std::string::npos) { 62 if (begin != std::string::npos) {
63 size_t end = version_string.find_first_not_of("01234567890.", begin); 63 size_t end = version_string.find_first_not_of("01234567890.", begin);
64 std::string sub_string; 64 std::string sub_string;
65 if (end != std::string::npos) 65 if (end != std::string::npos)
66 sub_string = version_string.substr(begin, end - begin); 66 sub_string = version_string.substr(begin, end - begin);
67 else 67 else
68 sub_string = version_string.substr(begin); 68 sub_string = version_string.substr(begin);
69 std::vector<std::string> pieces; 69 std::vector<std::string> pieces;
70 base::SplitString(sub_string, '.', &pieces); 70 base::SplitString(sub_string, '.', &pieces);
71 if (pieces.size() >= 2) 71 if (pieces.size() >= 2)
72 return pieces[0] + "." + pieces[1]; 72 return pieces[0] + "." + pieces[1];
73 } 73 }
74 return ""; 74 return std::string();
75 } 75 }
76 76
77 } // namespace anonymous 77 } // namespace anonymous
78 78
79 namespace gpu_info_collector { 79 namespace gpu_info_collector {
80 80
81 bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info) { 81 bool CollectGraphicsInfoGL(content::GPUInfo* gpu_info) {
82 if (!gfx::GLSurface::InitializeOneOff()) { 82 if (!gfx::GLSurface::InitializeOneOff()) {
83 LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed"; 83 LOG(ERROR) << "gfx::GLSurface::InitializeOneOff() failed";
84 return false; 84 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context; 130 basic_gpu_info->can_lose_context = context_gpu_info.can_lose_context;
131 basic_gpu_info->sandboxed = context_gpu_info.sandboxed; 131 basic_gpu_info->sandboxed = context_gpu_info.sandboxed;
132 basic_gpu_info->gpu_accessible = context_gpu_info.gpu_accessible; 132 basic_gpu_info->gpu_accessible = context_gpu_info.gpu_accessible;
133 basic_gpu_info->finalized = context_gpu_info.finalized; 133 basic_gpu_info->finalized = context_gpu_info.finalized;
134 basic_gpu_info->initialization_time = context_gpu_info.initialization_time; 134 basic_gpu_info->initialization_time = context_gpu_info.initialization_time;
135 } 135 }
136 136
137 } // namespace gpu_info_collector 137 } // namespace gpu_info_collector
138 138
OLDNEW
« no previous file with comments | « content/browser/worker_host/test/worker_browsertest.cc ('k') | content/public/test/test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698