Chromium Code Reviews| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 observerList->zeroedObservers.append(index); | 97 observerList->zeroedObservers.append(index); |
| 98 } | 98 } |
| 99 | 99 |
| 100 if (!observerList->iterating && !observerList->zeroedObservers.isEmpty()) | 100 if (!observerList->iterating && !observerList->zeroedObservers.isEmpty()) |
| 101 collectZeroedObservers(observerList, context); | 101 collectZeroedObservers(observerList, context); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void NetworkStateNotifier::setTestUpdatesOnly(bool updatesOnly) | 104 void NetworkStateNotifier::setTestUpdatesOnly(bool updatesOnly) |
| 105 { | 105 { |
| 106 ASSERT(isMainThread()); | 106 ASSERT(isMainThread()); |
| 107 | |
| 108 // Reset state to default when entering or leaving test mode. | |
| 109 if (updatesOnly || m_testUpdatesOnly) { | |
|
philipj_slow
2015/10/01 09:24:07
Should this say updatesOnly != m_testUpdatseOnly i
DaleCurtis
2015/10/01 19:25:54
w/o this if I disable the setWebConnectionFortest(
DaleCurtis
2015/10/20 21:56:51
Done.
| |
| 110 m_isOnLine = true; | |
| 111 m_type = WebConnectionTypeOther; | |
| 112 m_maxBandwidthMbps = std::numeric_limits<double>::infinity(); | |
| 113 } | |
| 114 | |
| 107 m_testUpdatesOnly = updatesOnly; | 115 m_testUpdatesOnly = updatesOnly; |
| 108 } | 116 } |
| 109 | 117 |
| 110 void NetworkStateNotifier::setWebConnectionForTest(WebConnectionType type, doubl e maxBandwidthMbps) | 118 void NetworkStateNotifier::setWebConnectionForTest(WebConnectionType type, doubl e maxBandwidthMbps) |
| 111 { | 119 { |
| 112 ASSERT(isMainThread()); | 120 ASSERT(isMainThread()); |
| 113 ASSERT(m_testUpdatesOnly); | 121 ASSERT(m_testUpdatesOnly); |
| 114 setWebConnectionImpl(type, maxBandwidthMbps); | 122 setWebConnectionImpl(type, maxBandwidthMbps); |
| 115 } | 123 } |
| 116 | 124 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 181 |
| 174 list->zeroedObservers.clear(); | 182 list->zeroedObservers.clear(); |
| 175 | 183 |
| 176 if (list->observers.isEmpty()) { | 184 if (list->observers.isEmpty()) { |
| 177 MutexLocker locker(m_mutex); | 185 MutexLocker locker(m_mutex); |
| 178 m_observers.remove(context); // deletes list | 186 m_observers.remove(context); // deletes list |
| 179 } | 187 } |
| 180 } | 188 } |
| 181 | 189 |
| 182 } // namespace blink | 190 } // namespace blink |
| OLD | NEW |