OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/runtime_features.h" | 5 #include "content/child/runtime_features.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "content/common/content_switches_internal.h" | 15 #include "content/common/content_switches_internal.h" |
16 #include "content/public/common/content_features.h" | 16 #include "content/public/common/content_features.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 18 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
19 #include "ui/gl/gl_switches.h" | 19 #include "ui/gl/gl_switches.h" |
20 #include "ui/native_theme/native_theme_switches.h" | 20 #include "ui/native_theme/native_theme_switches.h" |
21 | 21 |
22 using blink::WebRuntimeFeatures; | 22 using blink::WebRuntimeFeatures; |
23 | 23 |
24 #if defined(OS_MACOSX) | |
25 namespace { | |
26 // If WebGL Image Chromium is allowed, this feature controls whether it is | |
27 // enabled. | |
28 const base::Feature kWebGLImageChromium{"WebGLImageChromium", | |
29 base::FEATURE_ENABLED_BY_DEFAULT}; | |
30 | |
31 // If Canvas2D Image Chromium is allowed, this feature controls whether it is | |
32 // enabled. | |
33 const base::Feature kCanvas2DImageChromium{"kCanvas2DImageChromium", | |
34 base::FEATURE_ENABLED_BY_DEFAULT}; | |
35 | |
36 } // namespace | |
Avi (use Gerrit)
2016/06/02 18:20:26
Other features in this file are defined in content
erikchen
2016/06/02 19:45:26
Didn't know about it. Fixed.
| |
37 #endif // defined(OS_MACOSX) | |
38 | |
24 namespace content { | 39 namespace content { |
25 | 40 |
26 static void SetRuntimeFeatureDefaultsForPlatform() { | 41 static void SetRuntimeFeatureDefaultsForPlatform() { |
27 #if defined(OS_ANDROID) | 42 #if defined(OS_ANDROID) |
28 // Android does not have support for PagePopup | 43 // Android does not have support for PagePopup |
29 WebRuntimeFeatures::enablePagePopup(false); | 44 WebRuntimeFeatures::enablePagePopup(false); |
30 // No plan to support complex UI for date/time INPUT types. | 45 // No plan to support complex UI for date/time INPUT types. |
31 WebRuntimeFeatures::enableInputMultipleFieldsUI(false); | 46 WebRuntimeFeatures::enableInputMultipleFieldsUI(false); |
32 // Android does not yet support SharedWorker. crbug.com/154571 | 47 // Android does not yet support SharedWorker. crbug.com/154571 |
33 WebRuntimeFeatures::enableSharedWorker(false); | 48 WebRuntimeFeatures::enableSharedWorker(false); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 WebRuntimeFeatures::forceDisplayList2dCanvas(true); | 122 WebRuntimeFeatures::forceDisplayList2dCanvas(true); |
108 | 123 |
109 if (command_line.HasSwitch(switches::kEnableWebGLDraftExtensions)) | 124 if (command_line.HasSwitch(switches::kEnableWebGLDraftExtensions)) |
110 WebRuntimeFeatures::enableWebGLDraftExtensions(true); | 125 WebRuntimeFeatures::enableWebGLDraftExtensions(true); |
111 | 126 |
112 #if defined(OS_MACOSX) | 127 #if defined(OS_MACOSX) |
113 bool enable_canvas_2d_image_chromium = command_line.HasSwitch( | 128 bool enable_canvas_2d_image_chromium = command_line.HasSwitch( |
114 switches::kEnableGpuMemoryBufferCompositorResources) && | 129 switches::kEnableGpuMemoryBufferCompositorResources) && |
115 !command_line.HasSwitch(switches::kDisable2dCanvasImageChromium) && | 130 !command_line.HasSwitch(switches::kDisable2dCanvasImageChromium) && |
116 !command_line.HasSwitch(switches::kDisableGpu); | 131 !command_line.HasSwitch(switches::kDisableGpu); |
132 | |
133 if (enable_canvas_2d_image_chromium) { | |
134 enable_canvas_2d_image_chromium = | |
135 base::FeatureList::IsEnabled(kCanvas2DImageChromium); | |
136 } | |
117 #else | 137 #else |
118 bool enable_canvas_2d_image_chromium = false; | 138 bool enable_canvas_2d_image_chromium = false; |
119 #endif | 139 #endif |
120 WebRuntimeFeatures::enableCanvas2dImageChromium( | 140 WebRuntimeFeatures::enableCanvas2dImageChromium( |
121 enable_canvas_2d_image_chromium); | 141 enable_canvas_2d_image_chromium); |
122 | 142 |
123 #if defined(OS_MACOSX) | 143 #if defined(OS_MACOSX) |
124 bool enable_web_gl_image_chromium = command_line.HasSwitch( | 144 bool enable_web_gl_image_chromium = command_line.HasSwitch( |
125 switches::kEnableGpuMemoryBufferCompositorResources) && | 145 switches::kEnableGpuMemoryBufferCompositorResources) && |
126 !command_line.HasSwitch(switches::kDisableWebGLImageChromium) && | 146 !command_line.HasSwitch(switches::kDisableWebGLImageChromium) && |
127 !command_line.HasSwitch(switches::kDisableGpu); | 147 !command_line.HasSwitch(switches::kDisableGpu); |
148 | |
149 if (enable_web_gl_image_chromium) { | |
150 enable_web_gl_image_chromium = | |
151 base::FeatureList::IsEnabled(kWebGLImageChromium); | |
152 } | |
128 #else | 153 #else |
129 bool enable_web_gl_image_chromium = | 154 bool enable_web_gl_image_chromium = |
130 command_line.HasSwitch(switches::kEnableWebGLImageChromium); | 155 command_line.HasSwitch(switches::kEnableWebGLImageChromium); |
131 #endif | 156 #endif |
132 WebRuntimeFeatures::enableWebGLImageChromium(enable_web_gl_image_chromium); | 157 WebRuntimeFeatures::enableWebGLImageChromium(enable_web_gl_image_chromium); |
133 | 158 |
134 if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) | 159 if (command_line.HasSwitch(switches::kForceOverlayFullscreenVideo)) |
135 WebRuntimeFeatures::forceOverlayFullscreenVideo(true); | 160 WebRuntimeFeatures::forceOverlayFullscreenVideo(true); |
136 | 161 |
137 if (ui::IsOverlayScrollbarEnabled()) | 162 if (ui::IsOverlayScrollbarEnabled()) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { | 268 if (command_line.HasSwitch(switches::kDisableBlinkFeatures)) { |
244 std::vector<std::string> disabled_features = base::SplitString( | 269 std::vector<std::string> disabled_features = base::SplitString( |
245 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), | 270 command_line.GetSwitchValueASCII(switches::kDisableBlinkFeatures), |
246 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 271 ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
247 for (const std::string& feature : disabled_features) | 272 for (const std::string& feature : disabled_features) |
248 WebRuntimeFeatures::enableFeatureFromString(feature, false); | 273 WebRuntimeFeatures::enableFeatureFromString(feature, false); |
249 } | 274 } |
250 } | 275 } |
251 | 276 |
252 } // namespace content | 277 } // namespace content |
OLD | NEW |