| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 ASSERT(isMainThread()); | 119 ASSERT(isMainThread()); |
| 120 | 120 |
| 121 MutexLocker locker(m_mutex); | 121 MutexLocker locker(m_mutex); |
| 122 if (m_type == type && m_maxBandwidthMbps == maxBandwidthMbps) | 122 if (m_type == type && m_maxBandwidthMbps == maxBandwidthMbps) |
| 123 return; | 123 return; |
| 124 m_type = type; | 124 m_type = type; |
| 125 m_maxBandwidthMbps = maxBandwidthMbps; | 125 m_maxBandwidthMbps = maxBandwidthMbps; |
| 126 | 126 |
| 127 for (const auto& entry : m_observers) { | 127 for (const auto& entry : m_observers) { |
| 128 ExecutionContext* context = entry.key; | 128 ExecutionContext* context = entry.key; |
| 129 context->postTask(FROM_HERE, createCrossThreadTask(&NetworkStateNotifier
::notifyObserversOfConnectionChangeOnContext, this, type, maxBandwidthMbps)); | 129 context->postTask(BLINK_FROM_HERE, createCrossThreadTask(&NetworkStateNo
tifier::notifyObserversOfConnectionChangeOnContext, this, type, maxBandwidthMbps
)); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 void NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext(WebConnect
ionType type, double maxBandwidthMbps, ExecutionContext* context) | 133 void NetworkStateNotifier::notifyObserversOfConnectionChangeOnContext(WebConnect
ionType type, double maxBandwidthMbps, ExecutionContext* context) |
| 134 { | 134 { |
| 135 ObserverList* observerList = lockAndFindObserverList(context); | 135 ObserverList* observerList = lockAndFindObserverList(context); |
| 136 | 136 |
| 137 // The context could have been removed before the notification task got to r
un. | 137 // The context could have been removed before the notification task got to r
un. |
| 138 if (!observerList) | 138 if (!observerList) |
| 139 return; | 139 return; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 list->zeroedObservers.clear(); | 174 list->zeroedObservers.clear(); |
| 175 | 175 |
| 176 if (list->observers.isEmpty()) { | 176 if (list->observers.isEmpty()) { |
| 177 MutexLocker locker(m_mutex); | 177 MutexLocker locker(m_mutex); |
| 178 m_observers.remove(context); // deletes list | 178 m_observers.remove(context); // deletes list |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace blink | 182 } // namespace blink |
| OLD | NEW |