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

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

Issue 2881073003: Support DataSaver for SharedWorker (Closed)
Patch Set: fix #include "public/web/WebDataSaverFlag.h" Created 3 years, 7 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 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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 WebMediaPlayer::Preload HTMLMediaElement::PreloadType() const { 2174 WebMediaPlayer::Preload HTMLMediaElement::PreloadType() const {
2175 const AtomicString& preload = FastGetAttribute(preloadAttr); 2175 const AtomicString& preload = FastGetAttribute(preloadAttr);
2176 if (DeprecatedEqualIgnoringCase(preload, "none")) { 2176 if (DeprecatedEqualIgnoringCase(preload, "none")) {
2177 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadNone); 2177 UseCounter::Count(GetDocument(), UseCounter::kHTMLMediaElementPreloadNone);
2178 return WebMediaPlayer::kPreloadNone; 2178 return WebMediaPlayer::kPreloadNone;
2179 } 2179 }
2180 2180
2181 // If the source scheme is requires network, force preload to 'none' on Data 2181 // If the source scheme is requires network, force preload to 'none' on Data
2182 // Saver and for low end devices. 2182 // Saver and for low end devices.
2183 if (GetDocument().GetSettings() && 2183 if (GetDocument().GetSettings() &&
2184 (GetDocument().GetSettings()->GetDataSaverEnabled() || 2184 (GetDocument().GetSettings()->GetDataSaverFlag() ==
2185 WebDataSaverFlag::kEnabled ||
2185 GetDocument().GetSettings()->GetForcePreloadNoneForMediaElements()) && 2186 GetDocument().GetSettings()->GetForcePreloadNoneForMediaElements()) &&
2186 (current_src_.Protocol() != "blob" && current_src_.Protocol() != "data" && 2187 (current_src_.Protocol() != "blob" && current_src_.Protocol() != "data" &&
2187 current_src_.Protocol() != "file")) { 2188 current_src_.Protocol() != "file")) {
2188 UseCounter::Count(GetDocument(), 2189 UseCounter::Count(GetDocument(),
2189 UseCounter::kHTMLMediaElementPreloadForcedNone); 2190 UseCounter::kHTMLMediaElementPreloadForcedNone);
2190 return WebMediaPlayer::kPreloadNone; 2191 return WebMediaPlayer::kPreloadNone;
2191 } 2192 }
2192 2193
2193 if (DeprecatedEqualIgnoringCase(preload, "metadata")) { 2194 if (DeprecatedEqualIgnoringCase(preload, "metadata")) {
2194 UseCounter::Count(GetDocument(), 2195 UseCounter::Count(GetDocument(),
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); 4082 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE);
4082 } 4083 }
4083 4084
4084 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) { 4085 void HTMLMediaElement::ViewportFillDebouncerTimerFired(TimerBase*) {
4085 mostly_filling_viewport_ = true; 4086 mostly_filling_viewport_ = true;
4086 if (web_media_player_) 4087 if (web_media_player_)
4087 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); 4088 web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_);
4088 } 4089 }
4089 4090
4090 } // namespace blink 4091 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698