| OLD | NEW |
| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 const int kInvalidMaxBandwidth = -1; | 137 const int kInvalidMaxBandwidth = -1; |
| 138 | 138 |
| 139 void setWebConnectionImpl(WebConnectionType, double maxBandwidthMbps); | 139 void setWebConnectionImpl(WebConnectionType, double maxBandwidthMbps); |
| 140 void setMaxBandwidthImpl(double maxBandwidthMbps); | 140 void setMaxBandwidthImpl(double maxBandwidthMbps); |
| 141 | 141 |
| 142 // The ObserverListMap is cross-thread accessed, adding/removing Observers r
unning | 142 // The ObserverListMap is cross-thread accessed, adding/removing Observers r
unning |
| 143 // within an ExecutionContext. Kept off-heap to ease cross-thread allocation
and use; | 143 // within an ExecutionContext. Kept off-heap to ease cross-thread allocation
and use; |
| 144 // the observers are (already) responsible for explicitly unregistering whil
e finalizing. | 144 // the observers are (already) responsible for explicitly unregistering whil
e finalizing. |
| 145 using ObserverListMap = HashMap<RawPtrWillBeUntracedMember<ExecutionContext>
, OwnPtr<ObserverList>>; | 145 using ObserverListMap = HashMap<UntracedMember<ExecutionContext>, OwnPtr<Obs
erverList>>; |
| 146 | 146 |
| 147 void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double ma
xBandwidthMbps, ExecutionContext*); | 147 void notifyObserversOfConnectionChangeOnContext(WebConnectionType, double ma
xBandwidthMbps, ExecutionContext*); |
| 148 | 148 |
| 149 ObserverList* lockAndFindObserverList(ExecutionContext*); | 149 ObserverList* lockAndFindObserverList(ExecutionContext*); |
| 150 | 150 |
| 151 // Removed observers are nulled out in the list in case the list is being | 151 // Removed observers are nulled out in the list in case the list is being |
| 152 // iterated over. Once done iterating, call this to clean up nulled | 152 // iterated over. Once done iterating, call this to clean up nulled |
| 153 // observers. | 153 // observers. |
| 154 void collectZeroedObservers(ObserverList*, ExecutionContext*); | 154 void collectZeroedObservers(ObserverList*, ExecutionContext*); |
| 155 | 155 |
| 156 mutable Mutex m_mutex; | 156 mutable Mutex m_mutex; |
| 157 bool m_initialized; | 157 bool m_initialized; |
| 158 bool m_isOnLine; | 158 bool m_isOnLine; |
| 159 WebConnectionType m_type; | 159 WebConnectionType m_type; |
| 160 double m_maxBandwidthMbps; | 160 double m_maxBandwidthMbps; |
| 161 ObserverListMap m_observers; | 161 ObserverListMap m_observers; |
| 162 bool m_testUpdatesOnly; | 162 bool m_testUpdatesOnly; |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 CORE_EXPORT NetworkStateNotifier& networkStateNotifier(); | 165 CORE_EXPORT NetworkStateNotifier& networkStateNotifier(); |
| 166 | 166 |
| 167 } // namespace blink | 167 } // namespace blink |
| 168 | 168 |
| 169 #endif // NetworkStateNotifier_h | 169 #endif // NetworkStateNotifier_h |
| OLD | NEW |