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

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

Issue 1381613003: Defer media loading while on cellular networks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "core/html/track/TextTrackList.h" 58 #include "core/html/track/TextTrackList.h"
59 #include "core/html/track/VideoTrack.h" 59 #include "core/html/track/VideoTrack.h"
60 #include "core/html/track/VideoTrackList.h" 60 #include "core/html/track/VideoTrackList.h"
61 #include "core/inspector/ConsoleMessage.h" 61 #include "core/inspector/ConsoleMessage.h"
62 #include "core/layout/LayoutVideo.h" 62 #include "core/layout/LayoutVideo.h"
63 #include "core/layout/LayoutView.h" 63 #include "core/layout/LayoutView.h"
64 #include "core/layout/compositing/PaintLayerCompositor.h" 64 #include "core/layout/compositing/PaintLayerCompositor.h"
65 #include "core/loader/FrameLoader.h" 65 #include "core/loader/FrameLoader.h"
66 #include "core/loader/FrameLoaderClient.h" 66 #include "core/loader/FrameLoaderClient.h"
67 #include "core/page/ChromeClient.h" 67 #include "core/page/ChromeClient.h"
68 #include "core/page/NetworkStateNotifier.h"
68 #include "platform/ContentType.h" 69 #include "platform/ContentType.h"
69 #include "platform/Logging.h" 70 #include "platform/Logging.h"
70 #include "platform/MIMETypeFromURL.h" 71 #include "platform/MIMETypeFromURL.h"
71 #include "platform/MIMETypeRegistry.h" 72 #include "platform/MIMETypeRegistry.h"
72 #include "platform/RuntimeEnabledFeatures.h" 73 #include "platform/RuntimeEnabledFeatures.h"
73 #include "platform/UserGestureIndicator.h" 74 #include "platform/UserGestureIndicator.h"
74 #include "platform/graphics/GraphicsLayer.h" 75 #include "platform/graphics/GraphicsLayer.h"
75 #include "platform/weborigin/SecurityOrigin.h" 76 #include "platform/weborigin/SecurityOrigin.h"
76 #include "public/platform/Platform.h" 77 #include "public/platform/Platform.h"
77 #include "public/platform/WebContentDecryptionModule.h" 78 #include "public/platform/WebContentDecryptionModule.h"
(...skipping 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 } 1901 }
1901 1902
1902 void HTMLMediaElement::setPreload(const AtomicString& preload) 1903 void HTMLMediaElement::setPreload(const AtomicString& preload)
1903 { 1904 {
1904 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data()); 1905 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data());
1905 setAttribute(preloadAttr, preload); 1906 setAttribute(preloadAttr, preload);
1906 } 1907 }
1907 1908
1908 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const 1909 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const
1909 { 1910 {
1911 // Force preload to none for cellular connections.
1912 if (networkStateNotifier().connectionType() == WebConnectionTypeCellular) {
1913 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedN one);
1914 return WebMediaPlayer::PreloadNone;
1915 }
1916
1910 const AtomicString& preload = fastGetAttribute(preloadAttr); 1917 const AtomicString& preload = fastGetAttribute(preloadAttr);
1911 if (equalIgnoringCase(preload, "none")) { 1918 if (equalIgnoringCase(preload, "none")) {
1912 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); 1919 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone);
1913 return WebMediaPlayer::PreloadNone; 1920 return WebMediaPlayer::PreloadNone;
1914 } 1921 }
1915 if (equalIgnoringCase(preload, "metadata")) { 1922 if (equalIgnoringCase(preload, "metadata")) {
1916 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a); 1923 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a);
1917 return WebMediaPlayer::PreloadMetaData; 1924 return WebMediaPlayer::PreloadMetaData;
1918 } 1925 }
1919 if (equalIgnoringCase(preload, "auto")) { 1926 if (equalIgnoringCase(preload, "auto")) {
(...skipping 1718 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 visitor->trace(m_client); 3645 visitor->trace(m_client);
3639 } 3646 }
3640 3647
3641 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3648 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3642 { 3649 {
3643 visitor->trace(m_client); 3650 visitor->trace(m_client);
3644 } 3651 }
3645 #endif 3652 #endif
3646 3653
3647 } 3654 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | third_party/WebKit/Source/core/page/NetworkStateNotifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698