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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 { | 717 { |
718 for (size_t i = 0; i < active_entries_.size(); ++i) { | 718 for (size_t i = 0; i < active_entries_.size(); ++i) { |
719 if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) | 719 if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) |
720 return true; | 720 return true; |
721 } | 721 } |
722 return false; | 722 return false; |
723 } | 723 } |
724 | 724 |
725 Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed, | 725 Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed, |
726 bool disable_accelerated_compositing, | 726 bool disable_accelerated_compositing, |
727 bool disable_accelerated_2D_canvas, | 727 bool enable_accelerated_2D_canvas, |
728 bool disable_experimental_webgl, | 728 bool disable_experimental_webgl, |
729 bool disable_multisampling) const { | 729 bool disable_multisampling) const { |
730 DictionaryValue* status = new DictionaryValue(); | 730 DictionaryValue* status = new DictionaryValue(); |
731 | 731 |
732 // Build the feature_status field. | 732 // Build the feature_status field. |
733 { | 733 { |
734 ListValue* feature_status_list = new ListValue(); | 734 ListValue* feature_status_list = new ListValue(); |
735 | 735 |
736 // 2d_canvas. | 736 // 2d_canvas. |
737 if (!gpu_access_allowed) { | 737 if (!gpu_access_allowed) { |
738 if (disable_accelerated_2D_canvas) | 738 if(enable_accelerated_2D_canvas) |
| 739 feature_status_list->Append(NewStatusValue("2d_canvas", |
| 740 "unavailable_software")); |
| 741 else |
739 feature_status_list->Append(NewStatusValue("2d_canvas", | 742 feature_status_list->Append(NewStatusValue("2d_canvas", |
740 "software")); | 743 "software")); |
741 else | 744 } else if (enable_accelerated_2D_canvas) { |
742 feature_status_list->Append(NewStatusValue("2d_canvas", | |
743 "unavailable_software")); | |
744 } else if (!disable_accelerated_2D_canvas) { | |
745 if (IsFeatureBlacklisted( | 745 if (IsFeatureBlacklisted( |
746 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) | 746 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) |
747 feature_status_list->Append(NewStatusValue("2d_canvas", | 747 feature_status_list->Append(NewStatusValue("2d_canvas", |
748 "unavailable_software")); | 748 "unavailable_software")); |
749 else | 749 else |
750 feature_status_list->Append(NewStatusValue("2d_canvas", | 750 feature_status_list->Append(NewStatusValue("2d_canvas", |
751 "enabled")); | 751 "enabled")); |
752 } else { | 752 } else { |
753 feature_status_list->Append(NewStatusValue("2d_canvas", | 753 feature_status_list->Append(NewStatusValue("2d_canvas", |
754 "software")); | 754 "software")); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 feature_status_list->Append(NewStatusValue("webgl", | 790 feature_status_list->Append(NewStatusValue("webgl", |
791 "unavailable_off")); | 791 "unavailable_off")); |
792 else | 792 else |
793 feature_status_list->Append(NewStatusValue("webgl", | 793 feature_status_list->Append(NewStatusValue("webgl", |
794 "enabled")); | 794 "enabled")); |
795 | 795 |
796 // multisampling | 796 // multisampling |
797 if (!gpu_access_allowed) | 797 if (!gpu_access_allowed) |
798 feature_status_list->Append(NewStatusValue("multisampling", | 798 feature_status_list->Append(NewStatusValue("multisampling", |
799 "unavailable_off")); | 799 "unavailable_off")); |
800 else if (disable_multisampling) | 800 else if(disable_multisampling) |
801 feature_status_list->Append(NewStatusValue("multisampling", | 801 feature_status_list->Append(NewStatusValue("multisampling", |
802 "disabled_off")); | 802 "disabled_off")); |
803 else if (IsFeatureBlacklisted( | 803 else if (IsFeatureBlacklisted( |
804 GpuFeatureFlags::kGpuFeatureMultisampling)) | 804 GpuFeatureFlags::kGpuFeatureMultisampling)) |
805 feature_status_list->Append(NewStatusValue("multisampling", | 805 feature_status_list->Append(NewStatusValue("multisampling", |
806 "disabled_off")); | 806 "disabled_off")); |
807 else | 807 else |
808 feature_status_list->Append(NewStatusValue("multisampling", | 808 feature_status_list->Append(NewStatusValue("multisampling", |
809 "enabled")); | 809 "enabled")); |
810 | 810 |
811 status->Set("featureStatus", feature_status_list); | 811 status->Set("featureStatus", feature_status_list); |
812 } | 812 } |
813 | 813 |
814 // Build the problems list. | 814 // Build the problems list. |
815 { | 815 { |
816 ListValue* problem_list = new ListValue(); | 816 ListValue* problem_list = new ListValue(); |
817 if (!gpu_access_allowed) { | 817 if(!gpu_access_allowed) { |
818 DictionaryValue* problem = new DictionaryValue(); | 818 DictionaryValue* problem = new DictionaryValue(); |
819 problem->SetString("description", | 819 problem->SetString("description", |
820 "GPU process was unable to boot. Access to GPU disallowed."); | 820 "GPU process was unable to boot. Access to GPU disallowed."); |
821 problem->Set("crBugs", new ListValue()); | 821 problem->Set("crBugs", new ListValue()); |
822 problem->Set("webkitBugs", new ListValue()); | 822 problem->Set("webkitBugs", new ListValue()); |
823 problem_list->Append(problem); | 823 problem_list->Append(problem); |
824 } | 824 } |
825 if (disable_accelerated_2D_canvas) { | 825 if(!enable_accelerated_2D_canvas) { |
826 DictionaryValue* problem = new DictionaryValue(); | 826 DictionaryValue* problem = new DictionaryValue(); |
827 problem->SetString("description", | 827 problem->SetString("description", |
828 "Accelerated 2D canvas has been disabled at the command line"); | 828 "Accelerated 2D canvas has not been enabled " |
| 829 "(in about:flags or command line)"); |
829 problem->Set("crBugs", new ListValue()); | 830 problem->Set("crBugs", new ListValue()); |
830 problem->Set("webkitBugs", new ListValue()); | 831 problem->Set("webkitBugs", new ListValue()); |
831 problem_list->Append(problem); | 832 problem_list->Append(problem); |
832 } | 833 } |
833 if (disable_accelerated_compositing) { | 834 if(disable_accelerated_compositing) { |
834 DictionaryValue* problem = new DictionaryValue(); | 835 DictionaryValue* problem = new DictionaryValue(); |
835 problem->SetString("description", | 836 problem->SetString("description", |
836 "Accelerated compositing has been disabled, either via about:flags " | 837 "Accelerated compositing has been disabled, either via about:flags " |
837 "or command line"); | 838 "or command line"); |
838 problem->Set("crBugs", new ListValue()); | 839 problem->Set("crBugs", new ListValue()); |
839 problem->Set("webkitBugs", new ListValue()); | 840 problem->Set("webkitBugs", new ListValue()); |
840 problem_list->Append(problem); | 841 problem_list->Append(problem); |
841 } | 842 } |
842 if (disable_experimental_webgl) { | 843 if(disable_experimental_webgl) { |
843 DictionaryValue* problem = new DictionaryValue(); | 844 DictionaryValue* problem = new DictionaryValue(); |
844 problem->SetString("description", | 845 problem->SetString("description", |
845 "WebGL has been disabled, either via about:flags " | 846 "WebGL has been disabled, either via about:flags " |
846 "or command line"); | 847 "or command line"); |
847 problem->Set("crBugs", new ListValue()); | 848 problem->Set("crBugs", new ListValue()); |
848 problem->Set("webkitBugs", new ListValue()); | 849 problem->Set("webkitBugs", new ListValue()); |
849 problem_list->Append(problem); | 850 problem_list->Append(problem); |
850 } | 851 } |
851 if (disable_multisampling) { | 852 if(disable_multisampling) { |
852 DictionaryValue* problem = new DictionaryValue(); | 853 DictionaryValue* problem = new DictionaryValue(); |
853 problem->SetString("description", | 854 problem->SetString("description", |
854 "Multisampling has been disabled, either via about:flags " | 855 "Multisampling has been disabled, either via about:flags " |
855 "or command line"); | 856 "or command line"); |
856 problem->Set("crBugs", new ListValue()); | 857 problem->Set("crBugs", new ListValue()); |
857 problem->Set("webkitBugs", new ListValue()); | 858 problem->Set("webkitBugs", new ListValue()); |
858 problem_list->Append(problem); | 859 problem_list->Append(problem); |
859 } | 860 } |
860 for (size_t i = 0; i < active_entries_.size(); ++i) { | 861 for (size_t i = 0; i < active_entries_.size(); ++i) { |
861 GpuBlacklistEntry* entry = active_entries_[i]; | 862 GpuBlacklistEntry* entry = active_entries_[i]; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 browser_version_info.reset( | 957 browser_version_info.reset( |
957 new VersionInfo(version_op, version_string, version_string2)); | 958 new VersionInfo(version_op, version_string, version_string2)); |
958 if (!browser_version_info->IsValid()) | 959 if (!browser_version_info->IsValid()) |
959 return kMalformed; | 960 return kMalformed; |
960 if (browser_version_info->Contains(*browser_version_)) | 961 if (browser_version_info->Contains(*browser_version_)) |
961 return kSupported; | 962 return kSupported; |
962 return kUnsupported; | 963 return kUnsupported; |
963 } | 964 } |
964 return kSupported; | 965 return kSupported; |
965 } | 966 } |
OLD | NEW |