| 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 25 matching lines...) Expand all Loading... |
| 36 DEFINE_TRACE(IdTargetObserverRegistry) { | 36 DEFINE_TRACE(IdTargetObserverRegistry) { |
| 37 visitor->trace(m_registry); | 37 visitor->trace(m_registry); |
| 38 visitor->trace(m_notifyingObserversInSet); | 38 visitor->trace(m_notifyingObserversInSet); |
| 39 } | 39 } |
| 40 | 40 |
| 41 void IdTargetObserverRegistry::addObserver(const AtomicString& id, | 41 void IdTargetObserverRegistry::addObserver(const AtomicString& id, |
| 42 IdTargetObserver* observer) { | 42 IdTargetObserver* observer) { |
| 43 if (id.isEmpty()) | 43 if (id.isEmpty()) |
| 44 return; | 44 return; |
| 45 | 45 |
| 46 IdToObserverSetMap::AddResult result = m_registry.add(id.impl(), nullptr); | 46 IdToObserverSetMap::AddResult result = m_registry.insert(id.impl(), nullptr); |
| 47 if (result.isNewEntry) | 47 if (result.isNewEntry) |
| 48 result.storedValue->value = new ObserverSet(); | 48 result.storedValue->value = new ObserverSet(); |
| 49 | 49 |
| 50 result.storedValue->value->insert(observer); | 50 result.storedValue->value->insert(observer); |
| 51 } | 51 } |
| 52 | 52 |
| 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; |
| (...skipping 28 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.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 |
| OLD | NEW |