| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |