Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1528843004: Only force preload=none over cellular for http, https, ftp URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media
Patch Set: Update. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 } 1001 }
1002 } 1002 }
1003 } 1003 }
1004 1004
1005 if (attemptLoad && canLoadURL(url, contentType)) { 1005 if (attemptLoad && canLoadURL(url, contentType)) {
1006 ASSERT(!webMediaPlayer()); 1006 ASSERT(!webMediaPlayer());
1007 1007
1008 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) { 1008 if (effectivePreloadType() == WebMediaPlayer::PreloadNone) {
1009 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this); 1009 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause preload == 'none'", this);
1010 deferLoad(); 1010 deferLoad();
1011 } else if (networkStateNotifier().isCellularConnectionType() && (m_curre ntSrc.protocolIsInHTTPFamily() || m_currentSrc.protocolIs("ftp"))) {
philipj_slow 2016/03/21 11:59:37 OK, so since we last discussed this, srirama@ has
1012 WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load b ecause because of cellular network.", this);
1013 deferLoad();
1011 } else { 1014 } else {
1012 startPlayerLoad(); 1015 startPlayerLoad();
1013 } 1016 }
1014 } else { 1017 } else {
1015 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); 1018 mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError);
1016 } 1019 }
1017 1020
1018 // If there is no poster to display, allow the media engine to render video frames as soon as 1021 // If there is no poster to display, allow the media engine to render video frames as soon as
1019 // they are available. 1022 // they are available.
1020 updateDisplayState(); 1023 updateDisplayState();
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 } 1919 }
1917 1920
1918 void HTMLMediaElement::setPreload(const AtomicString& preload) 1921 void HTMLMediaElement::setPreload(const AtomicString& preload)
1919 { 1922 {
1920 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data()); 1923 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data());
1921 setAttribute(preloadAttr, preload); 1924 setAttribute(preloadAttr, preload);
1922 } 1925 }
1923 1926
1924 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const 1927 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const
1925 { 1928 {
1926 // Force preload to none for cellular connections.
1927 if (networkStateNotifier().isCellularConnectionType()) {
1928 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedN one);
1929 return WebMediaPlayer::PreloadNone;
1930 }
1931
1932 const AtomicString& preload = fastGetAttribute(preloadAttr); 1929 const AtomicString& preload = fastGetAttribute(preloadAttr);
1933 if (equalIgnoringCase(preload, "none")) { 1930 if (equalIgnoringCase(preload, "none")) {
1934 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); 1931 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone);
1935 return WebMediaPlayer::PreloadNone; 1932 return WebMediaPlayer::PreloadNone;
1936 } 1933 }
1937 if (equalIgnoringCase(preload, "metadata")) { 1934 if (equalIgnoringCase(preload, "metadata")) {
1938 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a); 1935 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a);
1939 return WebMediaPlayer::PreloadMetaData; 1936 return WebMediaPlayer::PreloadMetaData;
1940 } 1937 }
1941 if (equalIgnoringCase(preload, "auto")) { 1938 if (equalIgnoringCase(preload, "auto")) {
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
3811 { 3808 {
3812 visitor->trace(m_client); 3809 visitor->trace(m_client);
3813 } 3810 }
3814 3811
3815 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3812 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3816 { 3813 {
3817 visitor->trace(m_client); 3814 visitor->trace(m_client);
3818 } 3815 }
3819 3816
3820 } // namespace blink 3817 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698