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

Side by Side Diff: third_party/WebKit/Source/core/page/NetworkStateNotifier.h

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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // before its ExecutionContext is deleted. It's possible for an observer to 83 // before its ExecutionContext is deleted. It's possible for an observer to
84 // be called twice for the same event if it is first removed and then added 84 // be called twice for the same event if it is first removed and then added
85 // during notification. 85 // during notification.
86 void addObserver(NetworkStateObserver*, ExecutionContext*); 86 void addObserver(NetworkStateObserver*, ExecutionContext*);
87 void removeObserver(NetworkStateObserver*, ExecutionContext*); 87 void removeObserver(NetworkStateObserver*, ExecutionContext*);
88 88
89 // The following functions are for testing purposes. 89 // The following functions are for testing purposes.
90 90
91 // When true, setWebConnectionType calls are ignored and only setWebConnecti onTypeForTest 91 // When true, setWebConnectionType calls are ignored and only setWebConnecti onTypeForTest
92 // can update the connection type. This is used for layout tests (see crbug. com/377736). 92 // can update the connection type. This is used for layout tests (see crbug. com/377736).
93 //
94 // Since this class is a singleton, tests must call this with false when com pleted to
95 // avoid indeterminate state across the test harness. When switching in or o ut of test
96 // mode, all state will be reset to default values.
93 void setTestUpdatesOnly(bool); 97 void setTestUpdatesOnly(bool);
94 // Tests should call this as it will change the type regardless of the value of m_testUpdatesOnly. 98 // Tests should call this as it will change the type regardless of the value of m_testUpdatesOnly.
95 void setWebConnectionForTest(WebConnectionType, double maxBandwidthMbps); 99 void setWebConnectionForTest(WebConnectionType, double maxBandwidthMbps);
96 100
97 private: 101 private:
98 struct ObserverList { 102 struct ObserverList {
99 ObserverList() 103 ObserverList()
100 : iterating(false) 104 : iterating(false)
101 { 105 {
102 } 106 }
(...skipping 22 matching lines...) Expand all
125 double m_maxBandwidthMbps; 129 double m_maxBandwidthMbps;
126 ObserverListMap m_observers; 130 ObserverListMap m_observers;
127 bool m_testUpdatesOnly; 131 bool m_testUpdatesOnly;
128 }; 132 };
129 133
130 CORE_EXPORT NetworkStateNotifier& networkStateNotifier(); 134 CORE_EXPORT NetworkStateNotifier& networkStateNotifier();
131 135
132 } // namespace blink 136 } // namespace blink
133 137
134 #endif // NetworkStateNotifier_h 138 #endif // NetworkStateNotifier_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/Source/core/page/NetworkStateNotifier.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698