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

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

Issue 796913002: Use C++11 range-based loop for core/clipboard, core/dom and core/testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 11 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
« no previous file with comments | « Source/core/dom/Fullscreen.cpp ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 { 72 {
73 ASSERT(!id.isEmpty()); 73 ASSERT(!id.isEmpty());
74 ASSERT(!m_registry.isEmpty()); 74 ASSERT(!m_registry.isEmpty());
75 75
76 m_notifyingObserversInSet = m_registry.get(id.impl()); 76 m_notifyingObserversInSet = m_registry.get(id.impl());
77 if (!m_notifyingObserversInSet) 77 if (!m_notifyingObserversInSet)
78 return; 78 return;
79 79
80 WillBeHeapVector<RawPtrWillBeMember<IdTargetObserver> > copy; 80 WillBeHeapVector<RawPtrWillBeMember<IdTargetObserver> > copy;
81 copyToVector(*m_notifyingObserversInSet, copy); 81 copyToVector(*m_notifyingObserversInSet, copy);
82 for (WillBeHeapVector<RawPtrWillBeMember<IdTargetObserver> >::const_iterator it = copy.begin(); it != copy.end(); ++it) { 82 for (const auto& observer : copy) {
83 if (m_notifyingObserversInSet->contains(*it)) 83 if (m_notifyingObserversInSet->contains(observer))
84 (*it)->idTargetChanged(); 84 observer->idTargetChanged();
85 } 85 }
86 86
87 if (m_notifyingObserversInSet->isEmpty()) 87 if (m_notifyingObserversInSet->isEmpty())
88 m_registry.remove(id.impl()); 88 m_registry.remove(id.impl());
89 89
90 m_notifyingObserversInSet = nullptr; 90 m_notifyingObserversInSet = nullptr;
91 } 91 }
92 92
93 bool IdTargetObserverRegistry::hasObservers(const AtomicString& id) const 93 bool IdTargetObserverRegistry::hasObservers(const AtomicString& id) const
94 { 94 {
95 if (id.isEmpty() || m_registry.isEmpty()) 95 if (id.isEmpty() || m_registry.isEmpty())
96 return false; 96 return false;
97 ObserverSet* set = m_registry.get(id.impl()); 97 ObserverSet* set = m_registry.get(id.impl());
98 return set && !set->isEmpty(); 98 return set && !set->isEmpty();
99 } 99 }
100 100
101 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Fullscreen.cpp ('k') | Source/core/dom/MutationObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698