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

Unified Diff: third_party/WebKit/Source/core/page/NetworkStateNotifier.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, 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/page/NetworkStateNotifier.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
diff --git a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
index 06809f857e5e2330e1f938bcd59eb1161a0632f7..6a5f39d0b8ccc3fda0087f18cc2ba87c3a87491b 100644
--- a/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
+++ b/third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp
@@ -104,6 +104,15 @@ void NetworkStateNotifier::removeObserver(NetworkStateObserver* observer, Execut
void NetworkStateNotifier::setTestUpdatesOnly(bool updatesOnly)
{
ASSERT(isMainThread());
+ MutexLocker locker(m_mutex);
+
+ // Reset state to default when entering or leaving test mode.
+ if (updatesOnly != m_testUpdatesOnly) {
+ m_isOnLine = true;
+ m_type = WebConnectionTypeOther;
+ m_maxBandwidthMbps = std::numeric_limits<double>::infinity();
+ }
+
m_testUpdatesOnly = updatesOnly;
}
« no previous file with comments | « third_party/WebKit/Source/core/page/NetworkStateNotifier.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698