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

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

Issue 2709033003: Migrate WTF::HashMap::get() to ::at() (Closed)
Patch Set: rebase 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ObserverSet* set = iter->value.get(); 60 ObserverSet* set = iter->value.get();
61 set->erase(observer); 61 set->erase(observer);
62 if (set->isEmpty() && set != m_notifyingObserversInSet) 62 if (set->isEmpty() && set != m_notifyingObserversInSet)
63 m_registry.remove(iter); 63 m_registry.remove(iter);
64 } 64 }
65 65
66 void IdTargetObserverRegistry::notifyObserversInternal(const AtomicString& id) { 66 void IdTargetObserverRegistry::notifyObserversInternal(const AtomicString& id) {
67 DCHECK(!id.isEmpty()); 67 DCHECK(!id.isEmpty());
68 DCHECK(!m_registry.isEmpty()); 68 DCHECK(!m_registry.isEmpty());
69 69
70 m_notifyingObserversInSet = m_registry.get(id.impl()); 70 m_notifyingObserversInSet = m_registry.at(id.impl());
71 if (!m_notifyingObserversInSet) 71 if (!m_notifyingObserversInSet)
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.erase(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.at(id.impl());
91 return set && !set->isEmpty(); 91 return set && !set->isEmpty();
92 } 92 }
93 93
94 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698