OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/gpu/gpu_blacklist.h" | 5 #include "content/browser/gpu/gpu_blacklist.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 GpuBlacklist::OsType os, | 653 GpuBlacklist::OsType os, |
654 Version* os_version, | 654 Version* os_version, |
655 const GPUInfo& gpu_info) { | 655 const GPUInfo& gpu_info) { |
656 active_entries_.clear(); | 656 active_entries_.clear(); |
657 GpuFeatureFlags flags; | 657 GpuFeatureFlags flags; |
658 | 658 |
659 if (os == kOsAny) | 659 if (os == kOsAny) |
660 os = GetOsType(); | 660 os = GetOsType(); |
661 scoped_ptr<Version> my_os_version; | 661 scoped_ptr<Version> my_os_version; |
662 if (os_version == NULL) { | 662 if (os_version == NULL) { |
663 std::string version_string; | 663 std::string version_string = base::SysInfo::OperatingSystemVersion(); |
664 #if defined(OS_MACOSX) | |
665 // Seems like base::SysInfo::OperatingSystemVersion() returns the wrong | |
666 // version in MacOsx. | |
667 int32 version_major, version_minor, version_bugfix; | |
668 base::SysInfo::OperatingSystemVersionNumbers( | |
669 &version_major, &version_minor, &version_bugfix); | |
670 version_string = base::StringPrintf("%d.%d.%d", | |
671 version_major, | |
672 version_minor, | |
673 version_bugfix); | |
674 #else | |
675 version_string = base::SysInfo::OperatingSystemVersion(); | |
676 size_t pos = version_string.find_first_not_of("0123456789."); | 664 size_t pos = version_string.find_first_not_of("0123456789."); |
677 if (pos != std::string::npos) | 665 if (pos != std::string::npos) |
678 version_string = version_string.substr(0, pos); | 666 version_string = version_string.substr(0, pos); |
679 #endif | |
680 my_os_version.reset(Version::GetVersionFromString(version_string)); | 667 my_os_version.reset(Version::GetVersionFromString(version_string)); |
681 os_version = my_os_version.get(); | 668 os_version = my_os_version.get(); |
682 } | 669 } |
683 DCHECK(os_version != NULL); | 670 DCHECK(os_version != NULL); |
684 | 671 |
685 for (size_t i = 0; i < blacklist_.size(); ++i) { | 672 for (size_t i = 0; i < blacklist_.size(); ++i) { |
686 if (blacklist_[i]->Contains(os, *os_version, gpu_info)) { | 673 if (blacklist_[i]->Contains(os, *os_version, gpu_info)) { |
687 flags.Combine(blacklist_[i]->GetGpuFeatureFlags()); | 674 flags.Combine(blacklist_[i]->GetGpuFeatureFlags()); |
688 active_entries_.push_back(blacklist_[i]); | 675 active_entries_.push_back(blacklist_[i]); |
689 } | 676 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 browser_version_info.reset( | 933 browser_version_info.reset( |
947 new VersionInfo(version_op, version_string, version_string2)); | 934 new VersionInfo(version_op, version_string, version_string2)); |
948 if (!browser_version_info->IsValid()) | 935 if (!browser_version_info->IsValid()) |
949 return kMalformed; | 936 return kMalformed; |
950 if (browser_version_info->Contains(*browser_version_)) | 937 if (browser_version_info->Contains(*browser_version_)) |
951 return kSupported; | 938 return kSupported; |
952 return kUnsupported; | 939 return kUnsupported; |
953 } | 940 } |
954 return kSupported; | 941 return kSupported; |
955 } | 942 } |
OLD | NEW |