Remove invocation of WebSettings::setFontRenderingNormal, which is a no-op.
[chromium-blink-merge.git] / gpu / config / gpu_info_collector_android.cc
bloba26606af18adb4e2abafbd9aae5006ca478b789d
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
3 // found in the LICENSE file.
5 #include "gpu/config/gpu_info_collector.h"
7 #include "base/android/build_info.h"
8 #include "base/command_line.h"
9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_piece.h"
12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h"
15 namespace {
17 std::string GetDriverVersionFromString(const std::string& version_string) {
18 // Extract driver version from the second number in a string like:
19 // "OpenGL ES 2.0 V@6.0 AU@ (CL@2946718)"
21 // Exclude first "2.0".
22 size_t begin = version_string.find_first_of("0123456789");
23 if (begin == std::string::npos)
24 return "0";
25 size_t end = version_string.find_first_not_of("01234567890.", begin);
27 // Extract number of the form "%d.%d"
28 begin = version_string.find_first_of("0123456789", end);
29 if (begin == std::string::npos)
30 return "0";
31 end = version_string.find_first_not_of("01234567890.", begin);
32 std::string sub_string;
33 if (end != std::string::npos)
34 sub_string = version_string.substr(begin, end - begin);
35 else
36 sub_string = version_string.substr(begin);
37 std::vector<std::string> pieces;
38 base::SplitString(sub_string, '.', &pieces);
39 if (pieces.size() < 2)
40 return "0";
41 return pieces[0] + "." + pieces[1];
46 namespace gpu {
48 bool CollectContextGraphicsInfo(GPUInfo* gpu_info) {
49 return CollectBasicGraphicsInfo(gpu_info);
52 GpuIDResult CollectGpuID(uint32* vendor_id, uint32* device_id) {
53 DCHECK(vendor_id && device_id);
54 *vendor_id = 0;
55 *device_id = 0;
56 return kGpuIDNotSupported;
59 bool CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
60 gpu_info->can_lose_context = false;
61 gpu_info->finalized = true;
63 gpu_info->machine_model = base::android::BuildInfo::GetInstance()->model();
65 // Create a short-lived context on the UI thread to collect the GL strings.
66 return CollectGraphicsInfoGL(gpu_info);
69 bool CollectDriverInfoGL(GPUInfo* gpu_info) {
70 gpu_info->driver_version = GetDriverVersionFromString(
71 gpu_info->gl_version_string);
72 return true;
75 void MergeGPUInfo(GPUInfo* basic_gpu_info,
76 const GPUInfo& context_gpu_info) {
77 MergeGPUInfoGL(basic_gpu_info, context_gpu_info);
80 } // namespace gpu