| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 MutexLocker locker(m_mutex); | 128 MutexLocker locker(m_mutex); |
| 129 m_initialized = true; | 129 m_initialized = true; |
| 130 | 130 |
| 131 if (m_type == type && m_maxBandwidthMbps == maxBandwidthMbps) | 131 if (m_type == type && m_maxBandwidthMbps == maxBandwidthMbps) |
| 132 return; | 132 return; |
| 133 m_type = type; | 133 m_type = type; |
| 134 m_maxBandwidthMbps = maxBandwidthMbps; | 134 m_maxBandwidthMbps = maxBandwidthMbps; |
| 135 | 135 |
| 136 for (const auto& entry : m_observers) { | 136 for (const auto& entry : m_observers) { |
| 137 ExecutionContext* context = entry.key; | 137 ExecutionContext* context = entry.key; |
| 138 context->postTask(BLINK_FROM_HERE, createCrossThreadTask(&NetworkStateNo
tifier::notifyObserversOfConnectionChangeOnContext, AllowCrossThreadAccess(this)
, type, maxBandwidthMbps)); | 138 context->postTask(BLINK_FROM_HERE, createCrossThreadTask(&NetworkStateNo
tifier::notifyObserversOfConnectionChangeOnContext, this, type, maxBandwidthMbps
)); |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 void NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext(WebConnect
ionType type, double maxBandwidthMbps, ExecutionContext* context) | 142 void NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext(WebConnect
ionType type, double maxBandwidthMbps, ExecutionContext* context) |
| 143 { | 143 { |
| 144 ObserverList* observerList = lockAndFindObserverList(context); | 144 ObserverList* observerList = lockAndFindObserverList(context); |
| 145 | 145 |
| 146 // The context could have been removed before the notification task got to r
un. | 146 // The context could have been removed before the notification task got to r
un. |
| 147 if (!observerList) | 147 if (!observerList) |
| 148 return; | 148 return; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 list->zeroedObservers.clear(); | 183 list->zeroedObservers.clear(); |
| 184 | 184 |
| 185 if (list->observers.isEmpty()) { | 185 if (list->observers.isEmpty()) { |
| 186 MutexLocker locker(m_mutex); | 186 MutexLocker locker(m_mutex); |
| 187 m_observers.remove(context); // deletes list | 187 m_observers.remove(context); // deletes list |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |