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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void IdTargetObserverRegistry::removeObserver(const AtomicString& id, | 53 void IdTargetObserverRegistry::removeObserver(const AtomicString& id, |
54 IdTargetObserver* observer) { | 54 IdTargetObserver* observer) { |
55 if (id.isEmpty() || m_registry.isEmpty()) | 55 if (id.isEmpty() || m_registry.isEmpty()) |
56 return; | 56 return; |
57 | 57 |
58 IdToObserverSetMap::iterator iter = m_registry.find(id.impl()); | 58 IdToObserverSetMap::iterator iter = m_registry.find(id.impl()); |
59 | 59 |
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.erase(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.at(id.impl()); | 70 m_notifyingObserversInSet = m_registry.at(id.impl()); |
71 if (!m_notifyingObserversInSet) | 71 if (!m_notifyingObserversInSet) |
72 return; | 72 return; |
73 | 73 |
(...skipping 11 matching lines...) Expand all Loading... |
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.at(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 |
OLD | NEW |