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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/common/content_switches_internal.h" | 8 #include "content/common/content_switches_internal.h" |
9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 10 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
11 #include "ui/native_theme/native_theme_switches.h" | 11 #include "ui/native_theme/native_theme_switches.h" |
12 | 12 |
13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
14 #include <cpu-features.h> | 14 #include <cpu-features.h> |
15 #include "media/base/android/media_codec_bridge.h" | 15 #include "media/base/android/media_codec_bridge.h" |
16 #endif | 16 #endif |
17 | 17 |
18 using blink::WebRuntimeFeatures; | 18 using blink::WebRuntimeFeatures; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 static void SetRuntimeFeatureDefaultsForPlatform() { | 22 static void SetRuntimeFeatureDefaultsForPlatform() { |
23 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
24 // MSE/EME implementation needs Android MediaCodec API. | 24 // MSE/EME implementation needs Android MediaCodec API. |
25 if (!media::MediaCodecBridge::IsAvailable()) { | 25 if (!media::MediaCodecBridge::IsAvailable()) { |
26 WebRuntimeFeatures::enableWebKitMediaSource(false); | 26 WebRuntimeFeatures::enableWebKitMediaSource(false); |
27 WebRuntimeFeatures::enableMediaSource(false); | 27 WebRuntimeFeatures::enableMediaSource(false); |
28 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); | 28 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); |
29 } | 29 } |
30 // WebAudio is enabled by default only on ARM and only when the | 30 // WebAudio is enabled by default on ARM and X86 and only when the |
31 // MediaCodec API is available. | 31 // MediaCodec API is available. |
32 WebRuntimeFeatures::enableWebAudio( | 32 WebRuntimeFeatures::enableWebAudio( |
33 media::MediaCodecBridge::IsAvailable() && | 33 media::MediaCodecBridge::IsAvailable() && |
34 (android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM)); | 34 ((android_getCpuFamily() == ANDROID_CPU_FAMILY_ARM) || |
| 35 (android_getCpuFamily() == ANDROID_CPU_FAMILY_X86))); |
35 // Android does not support the Gamepad API. | 36 // Android does not support the Gamepad API. |
36 WebRuntimeFeatures::enableGamepad(false); | 37 WebRuntimeFeatures::enableGamepad(false); |
37 // Android does not have support for PagePopup | 38 // Android does not have support for PagePopup |
38 WebRuntimeFeatures::enablePagePopup(false); | 39 WebRuntimeFeatures::enablePagePopup(false); |
39 // Android does not yet support the Web Notification API. crbug.com/115320 | 40 // Android does not yet support the Web Notification API. crbug.com/115320 |
40 WebRuntimeFeatures::enableNotifications(false); | 41 WebRuntimeFeatures::enableNotifications(false); |
41 // Android does not yet support SharedWorker. crbug.com/154571 | 42 // Android does not yet support SharedWorker. crbug.com/154571 |
42 WebRuntimeFeatures::enableSharedWorker(false); | 43 WebRuntimeFeatures::enableSharedWorker(false); |
43 // Android does not yet support NavigatorContentUtils. | 44 // Android does not yet support NavigatorContentUtils. |
44 WebRuntimeFeatures::enableNavigatorContentUtils(false); | 45 WebRuntimeFeatures::enableNavigatorContentUtils(false); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 91 } |
91 | 92 |
92 if (!command_line.HasSwitch(switches::kEnableSpeechRecognition)) | 93 if (!command_line.HasSwitch(switches::kEnableSpeechRecognition)) |
93 WebRuntimeFeatures::enableScriptedSpeech(false); | 94 WebRuntimeFeatures::enableScriptedSpeech(false); |
94 #endif | 95 #endif |
95 | 96 |
96 if (command_line.HasSwitch(switches::kEnableServiceWorker)) | 97 if (command_line.HasSwitch(switches::kEnableServiceWorker)) |
97 WebRuntimeFeatures::enableServiceWorker(true); | 98 WebRuntimeFeatures::enableServiceWorker(true); |
98 | 99 |
99 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) |
100 // WebAudio requires the MediaCodec API. | 101 // WebAudio is enabled by default on ARM and X86, if the MediaCodec |
101 #if defined(ARCH_CPU_X86) | 102 // API is available. |
102 // WebAudio is disabled by default on x86. | |
103 WebRuntimeFeatures::enableWebAudio( | |
104 command_line.HasSwitch(switches::kEnableWebAudio) && | |
105 media::MediaCodecBridge::IsAvailable()); | |
106 #elif defined(ARCH_CPU_ARMEL) | |
107 // WebAudio is enabled by default on ARM. | |
108 WebRuntimeFeatures::enableWebAudio( | 103 WebRuntimeFeatures::enableWebAudio( |
109 !command_line.HasSwitch(switches::kDisableWebAudio) && | 104 !command_line.HasSwitch(switches::kDisableWebAudio) && |
110 media::MediaCodecBridge::IsAvailable()); | 105 media::MediaCodecBridge::IsAvailable()); |
111 #else | 106 #else |
112 WebRuntimeFeatures::enableWebAudio(false); | |
113 #endif | |
114 #else | |
115 if (command_line.HasSwitch(switches::kDisableWebAudio)) | 107 if (command_line.HasSwitch(switches::kDisableWebAudio)) |
116 WebRuntimeFeatures::enableWebAudio(false); | 108 WebRuntimeFeatures::enableWebAudio(false); |
117 #endif | 109 #endif |
118 | 110 |
119 if (command_line.HasSwitch(switches::kEnableEncryptedMedia)) | 111 if (command_line.HasSwitch(switches::kEnableEncryptedMedia)) |
120 WebRuntimeFeatures::enableEncryptedMedia(true); | 112 WebRuntimeFeatures::enableEncryptedMedia(true); |
121 | 113 |
122 if (command_line.HasSwitch(switches::kDisablePrefixedEncryptedMedia)) | 114 if (command_line.HasSwitch(switches::kDisablePrefixedEncryptedMedia)) |
123 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); | 115 WebRuntimeFeatures::enablePrefixedEncryptedMedia(false); |
124 | 116 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 WebRuntimeFeatures::enableRepaintAfterLayout(true); | 160 WebRuntimeFeatures::enableRepaintAfterLayout(true); |
169 | 161 |
170 if (command_line.HasSwitch(switches::kEnableTargetedStyleRecalc)) | 162 if (command_line.HasSwitch(switches::kEnableTargetedStyleRecalc)) |
171 WebRuntimeFeatures::enableTargetedStyleRecalc(true); | 163 WebRuntimeFeatures::enableTargetedStyleRecalc(true); |
172 | 164 |
173 if (command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) | 165 if (command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) |
174 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); | 166 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); |
175 } | 167 } |
176 | 168 |
177 } // namespace content | 169 } // namespace content |
OLD | NEW |