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

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

Issue 2546993003: [MediaElement] Allow preloading for non-network scheme src (Closed)
Patch Set: rebased Created 4 years 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 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 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 setAttribute(preloadAttr, preload); 2063 setAttribute(preloadAttr, preload);
2064 } 2064 }
2065 2065
2066 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const { 2066 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const {
2067 const AtomicString& preload = fastGetAttribute(preloadAttr); 2067 const AtomicString& preload = fastGetAttribute(preloadAttr);
2068 if (equalIgnoringCase(preload, "none")) { 2068 if (equalIgnoringCase(preload, "none")) {
2069 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); 2069 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone);
2070 return WebMediaPlayer::PreloadNone; 2070 return WebMediaPlayer::PreloadNone;
2071 } 2071 }
2072 2072
2073 // Force preload to 'none' on Data Saver and for low end devices. 2073 // Force preload to 'none' on Data Saver and for low end devices.
mlamouri (slow - plz ping) 2016/12/05 13:32:44 Can you update the comment? Or actually remove it
Zhiqiang Zhang (Slow) 2016/12/05 16:32:19 Updated comments.
2074 if (document().settings() && 2074 if (document().settings() &&
2075 (document().settings()->dataSaverEnabled() || 2075 (document().settings()->dataSaverEnabled() ||
2076 document().settings()->forcePreloadNoneForMediaElements())) { 2076 document().settings()->forcePreloadNoneForMediaElements()) &&
2077 (m_currentSrc.protocol() != "blob" && m_currentSrc.protocol() != "data" &&
2078 m_currentSrc.protocol() != "file")) {
2077 UseCounter::count(document(), 2079 UseCounter::count(document(),
2078 UseCounter::HTMLMediaElementPreloadForcedNone); 2080 UseCounter::HTMLMediaElementPreloadForcedNone);
2079 return WebMediaPlayer::PreloadNone; 2081 return WebMediaPlayer::PreloadNone;
2080 } 2082 }
2081 2083
2082 if (equalIgnoringCase(preload, "metadata")) { 2084 if (equalIgnoringCase(preload, "metadata")) {
2083 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata); 2085 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadata);
2084 return WebMediaPlayer::PreloadMetaData; 2086 return WebMediaPlayer::PreloadMetaData;
2085 } 2087 }
2086 2088
(...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after
4077 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4079 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4078 } 4080 }
4079 4081
4080 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { 4082 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) {
4081 m_mostlyFillingViewport = true; 4083 m_mostlyFillingViewport = true;
4082 if (m_webMediaPlayer) 4084 if (m_webMediaPlayer)
4083 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); 4085 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport);
4084 } 4086 }
4085 4087
4086 } // namespace blink 4088 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698