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