| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 requires the MediaCodec API. |
| 101 #if defined(ARCH_CPU_X86) | 102 #if defined(ARCH_CPU_ARMEL) || defined(ARCH_CPU_X86) |
| 102 // WebAudio is disabled by default on x86. | 103 // WebAudio is enabled by default on ARM and 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( | 104 WebRuntimeFeatures::enableWebAudio( |
| 109 !command_line.HasSwitch(switches::kDisableWebAudio) && | 105 !command_line.HasSwitch(switches::kDisableWebAudio) && |
| 110 media::MediaCodecBridge::IsAvailable()); | 106 media::MediaCodecBridge::IsAvailable()); |
| 111 #else | 107 #else |
| 112 WebRuntimeFeatures::enableWebAudio(false); | 108 WebRuntimeFeatures::enableWebAudio(false); |
| 113 #endif | 109 #endif |
| 114 #else | 110 #else |
| 115 if (command_line.HasSwitch(switches::kDisableWebAudio)) | 111 if (command_line.HasSwitch(switches::kDisableWebAudio)) |
| 116 WebRuntimeFeatures::enableWebAudio(false); | 112 WebRuntimeFeatures::enableWebAudio(false); |
| 117 #endif | 113 #endif |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 WebRuntimeFeatures::enableRepaintAfterLayout(true); | 163 WebRuntimeFeatures::enableRepaintAfterLayout(true); |
| 168 | 164 |
| 169 if (command_line.HasSwitch(switches::kEnableTargetedStyleRecalc)) | 165 if (command_line.HasSwitch(switches::kEnableTargetedStyleRecalc)) |
| 170 WebRuntimeFeatures::enableTargetedStyleRecalc(true); | 166 WebRuntimeFeatures::enableTargetedStyleRecalc(true); |
| 171 | 167 |
| 172 if (command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) | 168 if (command_line.HasSwitch(switches::kEnableBleedingEdgeRenderingFastPaths)) |
| 173 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); | 169 WebRuntimeFeatures::enableBleedingEdgeFastPaths(true); |
| 174 } | 170 } |
| 175 | 171 |
| 176 } // namespace content | 172 } // namespace content |
| OLD | NEW |