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

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

Issue 2344353003: Force preload=none and disable autoplay on lowend Android devices. (Closed)
Patch Set: Disable autoplay too. Created 4 years, 3 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
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 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 void HTMLMediaElement::setPreload(const AtomicString& preload) 1996 void HTMLMediaElement::setPreload(const AtomicString& preload)
1997 { 1997 {
1998 BLINK_MEDIA_LOG << "setPreload(" << (void*)this << ", " << preload << ")"; 1998 BLINK_MEDIA_LOG << "setPreload(" << (void*)this << ", " << preload << ")";
1999 setAttribute(preloadAttr, preload); 1999 setAttribute(preloadAttr, preload);
2000 } 2000 }
2001 2001
2002 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const 2002 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const
2003 { 2003 {
2004 // Force preload to none for cellular connections or when data saver is expl icitly set. 2004 // Force preload to none for cellular connections or when data saver is expl icitly set.
2005 if (networkStateNotifier().isCellularConnectionType() 2005 if (networkStateNotifier().isCellularConnectionType()
2006 || (document().settings() && document().settings()->dataSaverEnabled())) { 2006 || (document().settings() && (document().settings()->dataSaverEnabled() || document().settings()->forcePreloadNoneForMediaElements()))) {
foolip 2016/09/19 13:58:54 Makes sense, as long as it's OK that calling play(
DaleCurtis 2016/09/19 21:04:46 Yes, this is fine since it's still relatively prot
2007 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedN one); 2007 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedN one);
2008 return WebMediaPlayer::PreloadNone; 2008 return WebMediaPlayer::PreloadNone;
2009 } 2009 }
2010 2010
2011 const AtomicString& preload = fastGetAttribute(preloadAttr); 2011 const AtomicString& preload = fastGetAttribute(preloadAttr);
2012 if (equalIgnoringCase(preload, "none")) { 2012 if (equalIgnoringCase(preload, "none")) {
2013 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); 2013 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone);
2014 return WebMediaPlayer::PreloadNone; 2014 return WebMediaPlayer::PreloadNone;
2015 } 2015 }
2016 if (equalIgnoringCase(preload, "metadata")) { 2016 if (equalIgnoringCase(preload, "metadata")) {
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
4027 4027
4028 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 4028 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
4029 { 4029 {
4030 IntRect result; 4030 IntRect result;
4031 if (LayoutObject* object = m_element->layoutObject()) 4031 if (LayoutObject* object = m_element->layoutObject())
4032 result = object->absoluteBoundingBoxRect(); 4032 result = object->absoluteBoundingBoxRect();
4033 return result; 4033 return result;
4034 } 4034 }
4035 4035
4036 } // namespace blink 4036 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698