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

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: Address comments. Created 5 years, 2 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "core/html/track/TextTrackList.h" 59 #include "core/html/track/TextTrackList.h"
60 #include "core/html/track/VideoTrack.h" 60 #include "core/html/track/VideoTrack.h"
61 #include "core/html/track/VideoTrackList.h" 61 #include "core/html/track/VideoTrackList.h"
62 #include "core/inspector/ConsoleMessage.h" 62 #include "core/inspector/ConsoleMessage.h"
63 #include "core/layout/LayoutVideo.h" 63 #include "core/layout/LayoutVideo.h"
64 #include "core/layout/LayoutView.h" 64 #include "core/layout/LayoutView.h"
65 #include "core/layout/compositing/PaintLayerCompositor.h" 65 #include "core/layout/compositing/PaintLayerCompositor.h"
66 #include "core/loader/FrameLoader.h" 66 #include "core/loader/FrameLoader.h"
67 #include "core/loader/FrameLoaderClient.h" 67 #include "core/loader/FrameLoaderClient.h"
68 #include "core/page/ChromeClient.h" 68 #include "core/page/ChromeClient.h"
69 #include "core/page/NetworkStateNotifier.h"
69 #include "platform/ContentType.h" 70 #include "platform/ContentType.h"
70 #include "platform/Logging.h" 71 #include "platform/Logging.h"
71 #include "platform/MIMETypeFromURL.h" 72 #include "platform/MIMETypeFromURL.h"
72 #include "platform/MIMETypeRegistry.h" 73 #include "platform/MIMETypeRegistry.h"
73 #include "platform/RuntimeEnabledFeatures.h" 74 #include "platform/RuntimeEnabledFeatures.h"
74 #include "platform/UserGestureIndicator.h" 75 #include "platform/UserGestureIndicator.h"
75 #include "platform/graphics/GraphicsLayer.h" 76 #include "platform/graphics/GraphicsLayer.h"
76 #include "platform/weborigin/SecurityOrigin.h" 77 #include "platform/weborigin/SecurityOrigin.h"
77 #include "public/platform/Platform.h" 78 #include "public/platform/Platform.h"
78 #include "public/platform/WebContentDecryptionModule.h" 79 #include "public/platform/WebContentDecryptionModule.h"
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 } 1929 }
1929 1930
1930 void HTMLMediaElement::setPreload(const AtomicString& preload) 1931 void HTMLMediaElement::setPreload(const AtomicString& preload)
1931 { 1932 {
1932 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data()); 1933 WTF_LOG(Media, "HTMLMediaElement::setPreload(%p, %s)", this, preload.utf8(). data());
1933 setAttribute(preloadAttr, preload); 1934 setAttribute(preloadAttr, preload);
1934 } 1935 }
1935 1936
1936 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const 1937 WebMediaPlayer::Preload HTMLMediaElement::preloadType() const
1937 { 1938 {
1939 // Force preload to none for cellular connections.
1940 if (networkStateNotifier().connectionType() == WebConnectionTypeCellular) {
1941 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadForcedN one);
1942 return WebMediaPlayer::PreloadNone;
1943 }
1944
1938 const AtomicString& preload = fastGetAttribute(preloadAttr); 1945 const AtomicString& preload = fastGetAttribute(preloadAttr);
1939 if (equalIgnoringCase(preload, "none")) { 1946 if (equalIgnoringCase(preload, "none")) {
1940 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone); 1947 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadNone);
1941 return WebMediaPlayer::PreloadNone; 1948 return WebMediaPlayer::PreloadNone;
1942 } 1949 }
1943 if (equalIgnoringCase(preload, "metadata")) { 1950 if (equalIgnoringCase(preload, "metadata")) {
1944 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a); 1951 UseCounter::count(document(), UseCounter::HTMLMediaElementPreloadMetadat a);
1945 return WebMediaPlayer::PreloadMetaData; 1952 return WebMediaPlayer::PreloadMetaData;
1946 } 1953 }
1947 if (equalIgnoringCase(preload, "auto")) { 1954 if (equalIgnoringCase(preload, "auto")) {
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after
3817 visitor->trace(m_client); 3824 visitor->trace(m_client);
3818 } 3825 }
3819 3826
3820 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) 3827 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl)
3821 { 3828 {
3822 visitor->trace(m_client); 3829 visitor->trace(m_client);
3823 } 3830 }
3824 #endif 3831 #endif
3825 3832
3826 } 3833 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698