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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 void NetworkStateNotifier::collectZeroedObservers( | 246 void NetworkStateNotifier::collectZeroedObservers( |
247 ObserverListMap& map, | 247 ObserverListMap& map, |
248 ObserverList* list, | 248 ObserverList* list, |
249 PassRefPtr<WebTaskRunner> taskRunner) { | 249 PassRefPtr<WebTaskRunner> taskRunner) { |
250 DCHECK(taskRunner->runsTasksOnCurrentThread()); | 250 DCHECK(taskRunner->runsTasksOnCurrentThread()); |
251 DCHECK(!list->iterating); | 251 DCHECK(!list->iterating); |
252 | 252 |
253 // If any observers were removed during the iteration they will have | 253 // If any observers were removed during the iteration they will have |
254 // 0 values, clean them up. | 254 // 0 values, clean them up. |
255 for (size_t i = 0; i < list->zeroedObservers.size(); ++i) | 255 for (size_t i = 0; i < list->zeroedObservers.size(); ++i) |
256 list->observers.remove(list->zeroedObservers[i]); | 256 list->observers.erase(list->zeroedObservers[i]); |
257 | 257 |
258 list->zeroedObservers.clear(); | 258 list->zeroedObservers.clear(); |
259 | 259 |
260 if (list->observers.isEmpty()) { | 260 if (list->observers.isEmpty()) { |
261 MutexLocker locker(m_mutex); | 261 MutexLocker locker(m_mutex); |
262 map.erase(taskRunner); // deletes list | 262 map.erase(taskRunner); // deletes list |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 } // namespace blink | 266 } // namespace blink |
OLD | NEW |