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

Side by Side Diff: Source/core/dom/custom/CustomElementObserver.cpp

Issue 296703009: Oilpan: move custom element objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix compilation issue pointed out by clang Created 6 years, 7 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
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/dom/custom/CustomElementObserver.h" 32 #include "core/dom/custom/CustomElementObserver.h"
33 33
34 #include "core/dom/Element.h"
35
34 namespace WebCore { 36 namespace WebCore {
35 37
36 CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObserve rs() 38 // Maps elements to the observer watching them. At most one per
39 // element at a time.
40 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<Element>, RawPtrWillBeMember<Cu stomElementObserver> > ElementObserverMap;
41
42 static ElementObserverMap& elementObservers()
37 { 43 {
38 DEFINE_STATIC_LOCAL(ElementObserverMap, map, ()); 44 DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<ElementObserverMap>, map, (adoptP trWillBeNoop(new ElementObserverMap())));
39 return map; 45 return *map;
40 } 46 }
41 47
42 void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* eleme nt) 48 void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* eleme nt)
43 { 49 {
44 ElementObserverMap::iterator it = elementObservers().find(element); 50 ElementObserverMap::iterator it = elementObservers().find(element);
45 if (it == elementObservers().end()) 51 if (it == elementObservers().end())
46 return; 52 return;
47 it->value->elementDidFinishParsingChildren(element); 53 it->value->elementDidFinishParsingChildren(element);
48 } 54 }
49 55
(...skipping 11 matching lines...) Expand all
61 ASSERT_UNUSED(result, result.isNewEntry); 67 ASSERT_UNUSED(result, result.isNewEntry);
62 } 68 }
63 69
64 void CustomElementObserver::unobserve(Element* element) 70 void CustomElementObserver::unobserve(Element* element)
65 { 71 {
66 CustomElementObserver* observer = elementObservers().take(element); 72 CustomElementObserver* observer = elementObservers().take(element);
67 ASSERT_UNUSED(observer, observer == this); 73 ASSERT_UNUSED(observer, observer == this);
68 } 74 }
69 75
70 } // namespace WebCore 76 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElementObserver.h ('k') | Source/core/dom/custom/CustomElementRegistrationContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698