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

Side by Side Diff: gpu/config/gpu_info_collector_mac.mm

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 "gpu/config/gpu_info_collector.h" 5 #include "gpu/config/gpu_info_collector.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 return kGpuIDFailure; 183 return kGpuIDFailure;
184 } 184 }
185 185
186 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) { 186 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
187 DCHECK(gpu_info); 187 DCHECK(gpu_info);
188 188
189 std::string model_name; 189 std::string model_name;
190 int32 model_major = 0, model_minor = 0; 190 int32 model_major = 0, model_minor = 0;
191 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(), 191 base::mac::ParseModelIdentifier(base::mac::GetModelIdentifier(),
192 &model_name, &model_major, &model_minor); 192 &model_name, &model_major, &model_minor);
193 ReplaceChars(model_name, " ", "_", &gpu_info->machine_model); 193 base::ReplaceChars(model_name, " ", "_", &gpu_info->machine_model);
194 gpu_info->machine_model += " " + base::IntToString(model_major) + 194 gpu_info->machine_model += " " + base::IntToString(model_major) +
195 "." + base::IntToString(model_minor); 195 "." + base::IntToString(model_minor);
196 196
197 return CollectPCIVideoCardInfo(gpu_info); 197 return CollectPCIVideoCardInfo(gpu_info);
198 } 198 }
199 199
200 bool CollectDriverInfoGL(GPUInfo* gpu_info) { 200 bool CollectDriverInfoGL(GPUInfo* gpu_info) {
201 DCHECK(gpu_info); 201 DCHECK(gpu_info);
202 202
203 // Extract the OpenGL driver version string from the GL_VERSION string. 203 // Extract the OpenGL driver version string from the GL_VERSION string.
204 // Mac OpenGL drivers have the driver version 204 // Mac OpenGL drivers have the driver version
205 // at the end of the gl version string preceded by a dash. 205 // at the end of the gl version string preceded by a dash.
206 // Use some jiggery-pokery to turn that utf8 string into a std::wstring. 206 // Use some jiggery-pokery to turn that utf8 string into a std::wstring.
207 std::string gl_version_string = gpu_info->gl_version_string; 207 std::string gl_version_string = gpu_info->gl_version_string;
208 size_t pos = gl_version_string.find_last_of('-'); 208 size_t pos = gl_version_string.find_last_of('-');
209 if (pos == std::string::npos) 209 if (pos == std::string::npos)
210 return false; 210 return false;
211 gpu_info->driver_version = gl_version_string.substr(pos + 1); 211 gpu_info->driver_version = gl_version_string.substr(pos + 1);
212 return true; 212 return true;
213 } 213 }
214 214
215 void MergeGPUInfo(GPUInfo* basic_gpu_info, 215 void MergeGPUInfo(GPUInfo* basic_gpu_info,
216 const GPUInfo& context_gpu_info) { 216 const GPUInfo& context_gpu_info) {
217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info); 217 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
218 } 218 }
219 219
220 } // namespace gpu 220 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698