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

Side by Side Diff: content/browser/gpu/gpu_blacklist.cc

Issue 7633038: Relax software rendering list parsing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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
« no previous file with comments | « content/browser/gpu/gpu_blacklist.h ('k') | content/browser/gpu/gpu_blacklist_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 : max_entry_id_(0) { 589 : max_entry_id_(0) {
590 browser_version_.reset(Version::GetVersionFromString(browser_version_string)); 590 browser_version_.reset(Version::GetVersionFromString(browser_version_string));
591 DCHECK(browser_version_.get() != NULL); 591 DCHECK(browser_version_.get() != NULL);
592 } 592 }
593 593
594 GpuBlacklist::~GpuBlacklist() { 594 GpuBlacklist::~GpuBlacklist() {
595 Clear(); 595 Clear();
596 } 596 }
597 597
598 bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context, 598 bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
599 bool current_os_only) { 599 bool current_os_only,
vangelis 2011/08/18 21:15:11 One more thing. Having two bool's next to each oth
600 bool tolerate_errors) {
600 scoped_ptr<Value> root; 601 scoped_ptr<Value> root;
601 root.reset(base::JSONReader::Read(json_context, false)); 602 root.reset(base::JSONReader::Read(json_context, false));
602 if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY)) 603 if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY))
603 return false; 604 return false;
604 605
605 DictionaryValue* root_dictionary = static_cast<DictionaryValue*>(root.get()); 606 DictionaryValue* root_dictionary = static_cast<DictionaryValue*>(root.get());
606 DCHECK(root_dictionary); 607 DCHECK(root_dictionary);
607 return LoadGpuBlacklist(*root_dictionary, current_os_only); 608 return LoadGpuBlacklist(*root_dictionary, current_os_only, tolerate_errors);
608 } 609 }
609 610
610 bool GpuBlacklist::LoadGpuBlacklist(const DictionaryValue& parsed_json, 611 bool GpuBlacklist::LoadGpuBlacklist(const DictionaryValue& parsed_json,
611 bool current_os_only) { 612 bool current_os_only,
613 bool tolerate_errors) {
612 std::vector<GpuBlacklistEntry*> entries; 614 std::vector<GpuBlacklistEntry*> entries;
613 615
614 std::string version_string; 616 std::string version_string;
615 parsed_json.GetString("version", &version_string); 617 parsed_json.GetString("version", &version_string);
616 version_.reset(Version::GetVersionFromString(version_string)); 618 version_.reset(Version::GetVersionFromString(version_string));
617 if (version_.get() == NULL) 619 if (version_.get() == NULL)
618 return false; 620 return false;
619 621
620 ListValue* list = NULL; 622 ListValue* list = NULL;
621 if (!parsed_json.GetList("entries", &list)) 623 if (!parsed_json.GetList("entries", &list))
(...skipping 15 matching lines...) Expand all
637 if (browser_version_support == kMalformed) 639 if (browser_version_support == kMalformed)
638 break; 640 break;
639 if (browser_version_support == kUnsupported) { 641 if (browser_version_support == kUnsupported) {
640 entry_count_expectation--; 642 entry_count_expectation--;
641 continue; 643 continue;
642 } 644 }
643 DCHECK(browser_version_support == kSupported); 645 DCHECK(browser_version_support == kSupported);
644 GpuBlacklistEntry* entry = 646 GpuBlacklistEntry* entry =
645 GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item, true); 647 GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item, true);
646 if (entry == NULL) 648 if (entry == NULL)
647 break; 649 continue;
vangelis 2011/08/18 20:51:11 It seems to me that entries with unknown fields wi
648 if (entry->id() > max_entry_id) 650 if (entry->id() > max_entry_id)
649 max_entry_id = entry->id(); 651 max_entry_id = entry->id();
650 entries.push_back(entry); 652 entries.push_back(entry);
651 } 653 }
652 654
653 if (entries.size() != entry_count_expectation) { 655 if (!tolerate_errors && entries.size() != entry_count_expectation) {
654 for (size_t i = 0; i < entries.size(); ++i) 656 for (size_t i = 0; i < entries.size(); ++i)
655 delete entries[i]; 657 delete entries[i];
656 return false; 658 return false;
657 } 659 }
658 660
659 Clear(); 661 Clear();
660 // Don't apply GPU blacklist for a non-registered OS. 662 // Don't apply GPU blacklist for a non-registered OS.
661 OsType os_filter = GetOsType(); 663 OsType os_filter = GetOsType();
662 if (os_filter != kOsUnknown) { 664 if (os_filter != kOsUnknown) {
663 for (size_t i = 0; i < entries.size(); ++i) { 665 for (size_t i = 0; i < entries.size(); ++i) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 entry->webkit_bugs()[j])); 884 entry->webkit_bugs()[j]));
883 problem->Set("webkitBugs", webkit_bugs); 885 problem->Set("webkitBugs", webkit_bugs);
884 886
885 problem_list->Append(problem); 887 problem_list->Append(problem);
886 } 888 }
887 status->Set("problems", problem_list); 889 status->Set("problems", problem_list);
888 } 890 }
889 return status; 891 return status;
890 } 892 }
891 893
894 size_t GpuBlacklist::num_entries() const {
895 return blacklist_.size();
896 }
897
892 uint32 GpuBlacklist::max_entry_id() const { 898 uint32 GpuBlacklist::max_entry_id() const {
893 return max_entry_id_; 899 return max_entry_id_;
894 } 900 }
895 901
896 bool GpuBlacklist::GetVersion(uint16* major, uint16* minor) const { 902 bool GpuBlacklist::GetVersion(uint16* major, uint16* minor) const {
897 DCHECK(major && minor); 903 DCHECK(major && minor);
898 *major = 0; 904 *major = 0;
899 *minor = 0; 905 *minor = 0;
900 if (version_.get() == NULL) 906 if (version_.get() == NULL)
901 return false; 907 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 browser_version_info.reset( 969 browser_version_info.reset(
964 new VersionInfo(version_op, version_string, version_string2)); 970 new VersionInfo(version_op, version_string, version_string2));
965 if (!browser_version_info->IsValid()) 971 if (!browser_version_info->IsValid())
966 return kMalformed; 972 return kMalformed;
967 if (browser_version_info->Contains(*browser_version_)) 973 if (browser_version_info->Contains(*browser_version_))
968 return kSupported; 974 return kSupported;
969 return kUnsupported; 975 return kUnsupported;
970 } 976 }
971 return kSupported; 977 return kSupported;
972 } 978 }
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_blacklist.h ('k') | content/browser/gpu/gpu_blacklist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698