| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 return PreloadTypeToString(PreloadType()); | 2222 return PreloadTypeToString(PreloadType()); |
| 2223 } | 2223 } |
| 2224 | 2224 |
| 2225 void HTMLMediaElement::setPreload(const AtomicString& preload) { | 2225 void HTMLMediaElement::setPreload(const AtomicString& preload) { |
| 2226 BLINK_MEDIA_LOG << "setPreload(" << (void*)this << ", " << preload << ")"; | 2226 BLINK_MEDIA_LOG << "setPreload(" << (void*)this << ", " << preload << ")"; |
| 2227 setAttribute(preloadAttr, preload); | 2227 setAttribute(preloadAttr, preload); |
| 2228 } | 2228 } |
| 2229 | 2229 |
| 2230 WebMediaPlayer::Preload HTMLMediaElement::PreloadType() const { | 2230 WebMediaPlayer::Preload HTMLMediaElement::PreloadType() const { |
| 2231 const AtomicString& preload = FastGetAttribute(preloadAttr); | 2231 const AtomicString& preload = FastGetAttribute(preloadAttr); |
| 2232 if (EqualIgnoringCase(preload, "none")) { | 2232 if (DeprecatedEqualIgnoringCase(preload, "none")) { |
| 2233 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadNone); | 2233 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadNone); |
| 2234 return WebMediaPlayer::kPreloadNone; | 2234 return WebMediaPlayer::kPreloadNone; |
| 2235 } | 2235 } |
| 2236 | 2236 |
| 2237 // If the source scheme is requires network, force preload to 'none' on Data | 2237 // If the source scheme is requires network, force preload to 'none' on Data |
| 2238 // Saver and for low end devices. | 2238 // Saver and for low end devices. |
| 2239 if (GetDocument().GetSettings() && | 2239 if (GetDocument().GetSettings() && |
| 2240 (GetDocument().GetSettings()->GetDataSaverEnabled() || | 2240 (GetDocument().GetSettings()->GetDataSaverEnabled() || |
| 2241 GetDocument().GetSettings()->GetForcePreloadNoneForMediaElements()) && | 2241 GetDocument().GetSettings()->GetForcePreloadNoneForMediaElements()) && |
| 2242 (current_src_.Protocol() != "blob" && current_src_.Protocol() != "data" && | 2242 (current_src_.Protocol() != "blob" && current_src_.Protocol() != "data" && |
| 2243 current_src_.Protocol() != "file")) { | 2243 current_src_.Protocol() != "file")) { |
| 2244 UseCounter::Count(GetDocument(), | 2244 UseCounter::Count(GetDocument(), |
| 2245 UseCounter::kHTMLMediaElementPreloadForcedNone); | 2245 UseCounter::kHTMLMediaElementPreloadForcedNone); |
| 2246 return WebMediaPlayer::kPreloadNone; | 2246 return WebMediaPlayer::kPreloadNone; |
| 2247 } | 2247 } |
| 2248 | 2248 |
| 2249 if (EqualIgnoringCase(preload, "metadata")) { | 2249 if (DeprecatedEqualIgnoringCase(preload, "metadata")) { |
| 2250 UseCounter::Count(GetDocument(), | 2250 UseCounter::Count(GetDocument(), |
| 2251 UseCounter::kHTMLMediaElementPreloadMetadata); | 2251 UseCounter::kHTMLMediaElementPreloadMetadata); |
| 2252 return WebMediaPlayer::kPreloadMetaData; | 2252 return WebMediaPlayer::kPreloadMetaData; |
| 2253 } | 2253 } |
| 2254 | 2254 |
| 2255 // Force preload to 'metadata' on cellular connections. | 2255 // Force preload to 'metadata' on cellular connections. |
| 2256 if (GetNetworkStateNotifier().IsCellularConnectionType()) { | 2256 if (GetNetworkStateNotifier().IsCellularConnectionType()) { |
| 2257 UseCounter::Count(GetDocument(), | 2257 UseCounter::Count(GetDocument(), |
| 2258 UseCounter::kHTMLMediaElementPreloadForcedMetadata); | 2258 UseCounter::kHTMLMediaElementPreloadForcedMetadata); |
| 2259 return WebMediaPlayer::kPreloadMetaData; | 2259 return WebMediaPlayer::kPreloadMetaData; |
| 2260 } | 2260 } |
| 2261 | 2261 |
| 2262 if (EqualIgnoringCase(preload, "auto")) { | 2262 if (DeprecatedEqualIgnoringCase(preload, "auto")) { |
| 2263 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadAuto); | 2263 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadAuto); |
| 2264 return WebMediaPlayer::kPreloadAuto; | 2264 return WebMediaPlayer::kPreloadAuto; |
| 2265 } | 2265 } |
| 2266 | 2266 |
| 2267 // "The attribute's missing value default is user-agent defined, though the | 2267 // "The attribute's missing value default is user-agent defined, though the |
| 2268 // Metadata state is suggested as a compromise between reducing server load | 2268 // Metadata state is suggested as a compromise between reducing server load |
| 2269 // and providing an optimal user experience." | 2269 // and providing an optimal user experience." |
| 2270 | 2270 |
| 2271 // The spec does not define an invalid value default: | 2271 // The spec does not define an invalid value default: |
| 2272 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=28950 | 2272 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=28950 |
| (...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3857 audio_source_node_ = source_node; | 3857 audio_source_node_ = source_node; |
| 3858 | 3858 |
| 3859 AudioSourceProviderClientLockScope scope(*this); | 3859 AudioSourceProviderClientLockScope scope(*this); |
| 3860 GetAudioSourceProvider().SetClient(audio_source_node_); | 3860 GetAudioSourceProvider().SetClient(audio_source_node_); |
| 3861 } | 3861 } |
| 3862 | 3862 |
| 3863 WebMediaPlayer::CORSMode HTMLMediaElement::CorsMode() const { | 3863 WebMediaPlayer::CORSMode HTMLMediaElement::CorsMode() const { |
| 3864 const AtomicString& cross_origin_mode = FastGetAttribute(crossoriginAttr); | 3864 const AtomicString& cross_origin_mode = FastGetAttribute(crossoriginAttr); |
| 3865 if (cross_origin_mode.IsNull()) | 3865 if (cross_origin_mode.IsNull()) |
| 3866 return WebMediaPlayer::kCORSModeUnspecified; | 3866 return WebMediaPlayer::kCORSModeUnspecified; |
| 3867 if (EqualIgnoringCase(cross_origin_mode, "use-credentials")) | 3867 if (DeprecatedEqualIgnoringCase(cross_origin_mode, "use-credentials")) |
| 3868 return WebMediaPlayer::kCORSModeUseCredentials; | 3868 return WebMediaPlayer::kCORSModeUseCredentials; |
| 3869 return WebMediaPlayer::kCORSModeAnonymous; | 3869 return WebMediaPlayer::kCORSModeAnonymous; |
| 3870 } | 3870 } |
| 3871 | 3871 |
| 3872 void HTMLMediaElement::SetWebLayer(WebLayer* web_layer) { | 3872 void HTMLMediaElement::SetWebLayer(WebLayer* web_layer) { |
| 3873 if (web_layer == web_layer_) | 3873 if (web_layer == web_layer_) |
| 3874 return; | 3874 return; |
| 3875 | 3875 |
| 3876 // If either of the layers is null we need to enable or disable compositing. | 3876 // If either of the layers is null we need to enable or disable compositing. |
| 3877 // This is done by triggering a style recalc. | 3877 // This is done by triggering a style recalc. |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4268 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4268 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4269 } | 4269 } |
| 4270 | 4270 |
| 4271 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { | 4271 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { |
| 4272 mostly_filling_viewport_ = true; | 4272 mostly_filling_viewport_ = true; |
| 4273 if (web_media_player_) | 4273 if (web_media_player_) |
| 4274 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); | 4274 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); |
| 4275 } | 4275 } |
| 4276 | 4276 |
| 4277 } // namespace blink | 4277 } // namespace blink |
| OLD | NEW |