| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/dom/CustomElementObserver.h" | 32 #include "core/dom/CustomElementObserver.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObserve
rs() | 36 CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObserve
rs() |
| 37 { | 37 { |
| 38 DEFINE_STATIC_LOCAL(ElementObserverMap, map, ()); | 38 DEFINE_STATIC_LOCAL(ElementObserverMap, map, ()); |
| 39 return map; | 39 return map; |
| 40 } | 40 } |
| 41 | 41 |
| 42 void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* eleme
nt) |
| 43 { |
| 44 ElementObserverMap::iterator it = elementObservers().find(element); |
| 45 if (it == elementObservers().end()) |
| 46 return; |
| 47 it->value->elementDidFinishParsingChildren(element); |
| 48 } |
| 49 |
| 42 void CustomElementObserver::notifyElementWasDestroyed(Element* element) | 50 void CustomElementObserver::notifyElementWasDestroyed(Element* element) |
| 43 { | 51 { |
| 44 ElementObserverMap::iterator it = elementObservers().find(element); | 52 ElementObserverMap::iterator it = elementObservers().find(element); |
| 45 if (it == elementObservers().end()) | 53 if (it == elementObservers().end()) |
| 46 return; | 54 return; |
| 47 it->value->elementWasDestroyed(element); | 55 it->value->elementWasDestroyed(element); |
| 48 } | 56 } |
| 49 | 57 |
| 50 void CustomElementObserver::observe(Element* element) | 58 void CustomElementObserver::observe(Element* element) |
| 51 { | 59 { |
| 52 ElementObserverMap::AddResult result = elementObservers().add(element, this)
; | 60 ElementObserverMap::AddResult result = elementObservers().add(element, this)
; |
| 53 ASSERT(result.isNewEntry); | 61 ASSERT(result.isNewEntry); |
| 54 } | 62 } |
| 55 | 63 |
| 56 void CustomElementObserver::unobserve(Element* element) | 64 void CustomElementObserver::unobserve(Element* element) |
| 57 { | 65 { |
| 58 CustomElementObserver* observer = elementObservers().take(element); | 66 CustomElementObserver* observer = elementObservers().take(element); |
| 59 ASSERT(observer == this); | 67 ASSERT(observer == this); |
| 60 } | 68 } |
| 61 | 69 |
| 62 } // namespace WebCore | 70 } // namespace WebCore |
| OLD | NEW |