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

Side by Side Diff: third_party/WebKit/Source/core/dom/IdTargetObserverRegistry.cpp

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: Created 3 years, 10 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) 2012 Google Inc. All Rights Reserved. 2 * Copyright (C) 2012 Google 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return; 72 return;
73 73
74 HeapVector<Member<IdTargetObserver>> copy; 74 HeapVector<Member<IdTargetObserver>> copy;
75 copyToVector(*m_notifyingObserversInSet, copy); 75 copyToVector(*m_notifyingObserversInSet, copy);
76 for (const auto& observer : copy) { 76 for (const auto& observer : copy) {
77 if (m_notifyingObserversInSet->contains(observer)) 77 if (m_notifyingObserversInSet->contains(observer))
78 observer->idTargetChanged(); 78 observer->idTargetChanged();
79 } 79 }
80 80
81 if (m_notifyingObserversInSet->isEmpty()) 81 if (m_notifyingObserversInSet->isEmpty())
82 m_registry.remove(id.impl()); 82 m_registry.erase(id.impl());
83 83
84 m_notifyingObserversInSet = nullptr; 84 m_notifyingObserversInSet = nullptr;
85 } 85 }
86 86
87 bool IdTargetObserverRegistry::hasObservers(const AtomicString& id) const { 87 bool IdTargetObserverRegistry::hasObservers(const AtomicString& id) const {
88 if (id.isEmpty() || m_registry.isEmpty()) 88 if (id.isEmpty() || m_registry.isEmpty())
89 return false; 89 return false;
90 ObserverSet* set = m_registry.get(id.impl()); 90 ObserverSet* set = m_registry.get(id.impl());
91 return set && !set->isEmpty(); 91 return set && !set->isEmpty();
92 } 92 }
93 93
94 } // namespace blink 94 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698