Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: third_party/WebKit/Source/platform/network/NetworkStateNotifier.cpp

Issue 2776203002: Migrate WTF::Vector::remove() to ::erase() (Closed)
Patch Set: rebase, repatch VectorTest Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698