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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 { | 706 { |
707 for (size_t i = 0; i < active_entries_.size(); ++i) { | 707 for (size_t i = 0; i < active_entries_.size(); ++i) { |
708 if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) | 708 if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) |
709 return true; | 709 return true; |
710 } | 710 } |
711 return false; | 711 return false; |
712 } | 712 } |
713 | 713 |
714 Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed, | 714 Value* GpuBlacklist::GetFeatureStatus(bool gpu_access_allowed, |
715 bool disable_accelerated_compositing, | 715 bool disable_accelerated_compositing, |
716 bool enable_accelerated_2D_canvas, | 716 bool disable_accelerated_2D_canvas, |
717 bool disable_experimental_webgl, | 717 bool disable_experimental_webgl, |
718 bool disable_multisampling) const { | 718 bool disable_multisampling) const { |
719 DictionaryValue* status = new DictionaryValue(); | 719 DictionaryValue* status = new DictionaryValue(); |
720 | 720 |
721 // Build the feature_status field. | 721 // Build the feature_status field. |
722 { | 722 { |
723 ListValue* feature_status_list = new ListValue(); | 723 ListValue* feature_status_list = new ListValue(); |
724 | 724 |
725 // 2d_canvas. | 725 // 2d_canvas. |
726 if (!gpu_access_allowed) { | 726 if (!gpu_access_allowed) { |
727 if(enable_accelerated_2D_canvas) | 727 if (disable_accelerated_2D_canvas) |
| 728 feature_status_list->Append(NewStatusValue("2d_canvas", |
| 729 "software")); |
| 730 else |
728 feature_status_list->Append(NewStatusValue("2d_canvas", | 731 feature_status_list->Append(NewStatusValue("2d_canvas", |
729 "unavailable_software")); | 732 "unavailable_software")); |
730 else | 733 } else if (!disable_accelerated_2D_canvas) { |
731 feature_status_list->Append(NewStatusValue("2d_canvas", | |
732 "software")); | |
733 } else if (enable_accelerated_2D_canvas) { | |
734 if (IsFeatureBlacklisted( | 734 if (IsFeatureBlacklisted( |
735 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) | 735 GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas)) |
736 feature_status_list->Append(NewStatusValue("2d_canvas", | 736 feature_status_list->Append(NewStatusValue("2d_canvas", |
737 "unavailable_software")); | 737 "unavailable_software")); |
738 else | 738 else |
739 feature_status_list->Append(NewStatusValue("2d_canvas", | 739 feature_status_list->Append(NewStatusValue("2d_canvas", |
740 "enabled")); | 740 "enabled")); |
741 } else { | 741 } else { |
742 feature_status_list->Append(NewStatusValue("2d_canvas", | 742 feature_status_list->Append(NewStatusValue("2d_canvas", |
743 "software")); | 743 "software")); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 feature_status_list->Append(NewStatusValue("webgl", | 779 feature_status_list->Append(NewStatusValue("webgl", |
780 "unavailable_off")); | 780 "unavailable_off")); |
781 else | 781 else |
782 feature_status_list->Append(NewStatusValue("webgl", | 782 feature_status_list->Append(NewStatusValue("webgl", |
783 "enabled")); | 783 "enabled")); |
784 | 784 |
785 // multisampling | 785 // multisampling |
786 if (!gpu_access_allowed) | 786 if (!gpu_access_allowed) |
787 feature_status_list->Append(NewStatusValue("multisampling", | 787 feature_status_list->Append(NewStatusValue("multisampling", |
788 "unavailable_off")); | 788 "unavailable_off")); |
789 else if(disable_multisampling) | 789 else if (disable_multisampling) |
790 feature_status_list->Append(NewStatusValue("multisampling", | 790 feature_status_list->Append(NewStatusValue("multisampling", |
791 "disabled_off")); | 791 "disabled_off")); |
792 else if (IsFeatureBlacklisted( | 792 else if (IsFeatureBlacklisted( |
793 GpuFeatureFlags::kGpuFeatureMultisampling)) | 793 GpuFeatureFlags::kGpuFeatureMultisampling)) |
794 feature_status_list->Append(NewStatusValue("multisampling", | 794 feature_status_list->Append(NewStatusValue("multisampling", |
795 "disabled_off")); | 795 "disabled_off")); |
796 else | 796 else |
797 feature_status_list->Append(NewStatusValue("multisampling", | 797 feature_status_list->Append(NewStatusValue("multisampling", |
798 "enabled")); | 798 "enabled")); |
799 | 799 |
800 status->Set("featureStatus", feature_status_list); | 800 status->Set("featureStatus", feature_status_list); |
801 } | 801 } |
802 | 802 |
803 // Build the problems list. | 803 // Build the problems list. |
804 { | 804 { |
805 ListValue* problem_list = new ListValue(); | 805 ListValue* problem_list = new ListValue(); |
806 if(!gpu_access_allowed) { | 806 if (!gpu_access_allowed) { |
807 DictionaryValue* problem = new DictionaryValue(); | 807 DictionaryValue* problem = new DictionaryValue(); |
808 problem->SetString("description", | 808 problem->SetString("description", |
809 "GPU process was unable to boot. Access to GPU disallowed."); | 809 "GPU process was unable to boot. Access to GPU disallowed."); |
810 problem->Set("crBugs", new ListValue()); | 810 problem->Set("crBugs", new ListValue()); |
811 problem->Set("webkitBugs", new ListValue()); | 811 problem->Set("webkitBugs", new ListValue()); |
812 problem_list->Append(problem); | 812 problem_list->Append(problem); |
813 } | 813 } |
814 if(!enable_accelerated_2D_canvas) { | 814 if (disable_accelerated_2D_canvas) { |
815 DictionaryValue* problem = new DictionaryValue(); | 815 DictionaryValue* problem = new DictionaryValue(); |
816 problem->SetString("description", | 816 problem->SetString("description", |
817 "Accelerated 2D canvas has not been enabled " | 817 "Accelerated 2D canvas has been disabled at the command line"); |
818 "(in about:flags or command line)"); | |
819 problem->Set("crBugs", new ListValue()); | 818 problem->Set("crBugs", new ListValue()); |
820 problem->Set("webkitBugs", new ListValue()); | 819 problem->Set("webkitBugs", new ListValue()); |
821 problem_list->Append(problem); | 820 problem_list->Append(problem); |
822 } | 821 } |
823 if(disable_accelerated_compositing) { | 822 if (disable_accelerated_compositing) { |
824 DictionaryValue* problem = new DictionaryValue(); | 823 DictionaryValue* problem = new DictionaryValue(); |
825 problem->SetString("description", | 824 problem->SetString("description", |
826 "Accelerated compositing has been disabled, either via about:flags " | 825 "Accelerated compositing has been disabled, either via about:flags " |
827 "or command line"); | 826 "or command line"); |
828 problem->Set("crBugs", new ListValue()); | 827 problem->Set("crBugs", new ListValue()); |
829 problem->Set("webkitBugs", new ListValue()); | 828 problem->Set("webkitBugs", new ListValue()); |
830 problem_list->Append(problem); | 829 problem_list->Append(problem); |
831 } | 830 } |
832 if(disable_experimental_webgl) { | 831 if (disable_experimental_webgl) { |
833 DictionaryValue* problem = new DictionaryValue(); | 832 DictionaryValue* problem = new DictionaryValue(); |
834 problem->SetString("description", | 833 problem->SetString("description", |
835 "WebGL has been disabled, either via about:flags " | 834 "WebGL has been disabled, either via about:flags " |
836 "or command line"); | 835 "or command line"); |
837 problem->Set("crBugs", new ListValue()); | 836 problem->Set("crBugs", new ListValue()); |
838 problem->Set("webkitBugs", new ListValue()); | 837 problem->Set("webkitBugs", new ListValue()); |
839 problem_list->Append(problem); | 838 problem_list->Append(problem); |
840 } | 839 } |
841 if(disable_multisampling) { | 840 if (disable_multisampling) { |
842 DictionaryValue* problem = new DictionaryValue(); | 841 DictionaryValue* problem = new DictionaryValue(); |
843 problem->SetString("description", | 842 problem->SetString("description", |
844 "Multisampling has been disabled, either via about:flags " | 843 "Multisampling has been disabled, either via about:flags " |
845 "or command line"); | 844 "or command line"); |
846 problem->Set("crBugs", new ListValue()); | 845 problem->Set("crBugs", new ListValue()); |
847 problem->Set("webkitBugs", new ListValue()); | 846 problem->Set("webkitBugs", new ListValue()); |
848 problem_list->Append(problem); | 847 problem_list->Append(problem); |
849 } | 848 } |
850 for (size_t i = 0; i < active_entries_.size(); ++i) { | 849 for (size_t i = 0; i < active_entries_.size(); ++i) { |
851 GpuBlacklistEntry* entry = active_entries_[i]; | 850 GpuBlacklistEntry* entry = active_entries_[i]; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 browser_version_info.reset( | 945 browser_version_info.reset( |
947 new VersionInfo(version_op, version_string, version_string2)); | 946 new VersionInfo(version_op, version_string, version_string2)); |
948 if (!browser_version_info->IsValid()) | 947 if (!browser_version_info->IsValid()) |
949 return kMalformed; | 948 return kMalformed; |
950 if (browser_version_info->Contains(*browser_version_)) | 949 if (browser_version_info->Contains(*browser_version_)) |
951 return kSupported; | 950 return kSupported; |
952 return kUnsupported; | 951 return kUnsupported; |
953 } | 952 } |
954 return kSupported; | 953 return kSupported; |
955 } | 954 } |
OLD | NEW |