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

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: Use LinkedHashSet for ElementSet instead. 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;
haraken 2014/05/26 15:40:23 I think you need to remove the following lines fro
sof 2014/05/26 16:41:08 Very good catch; made it conditional on !ENABLE(OI
sof 2014/05/26 19:25:37 Just to continue that thought & looking at details
41
42 static ElementObserverMap& elementObservers()
37 { 43 {
44 #if ENABLE(OILPAN)
45 DEFINE_STATIC_LOCAL(Persistent<ElementObserverMap>, map, (new ElementObserve rMap()));
46 return *map;
47 #else
38 DEFINE_STATIC_LOCAL(ElementObserverMap, map, ()); 48 DEFINE_STATIC_LOCAL(ElementObserverMap, map, ());
39 return map; 49 return map;
50 #endif
40 } 51 }
41 52
42 void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* eleme nt) 53 void CustomElementObserver::notifyElementDidFinishParsingChildren(Element* eleme nt)
43 { 54 {
44 ElementObserverMap::iterator it = elementObservers().find(element); 55 ElementObserverMap::iterator it = elementObservers().find(element);
45 if (it == elementObservers().end()) 56 if (it == elementObservers().end())
46 return; 57 return;
47 it->value->elementDidFinishParsingChildren(element); 58 it->value->elementDidFinishParsingChildren(element);
48 } 59 }
49 60
(...skipping 11 matching lines...) Expand all
61 ASSERT_UNUSED(result, result.isNewEntry); 72 ASSERT_UNUSED(result, result.isNewEntry);
62 } 73 }
63 74
64 void CustomElementObserver::unobserve(Element* element) 75 void CustomElementObserver::unobserve(Element* element)
65 { 76 {
66 CustomElementObserver* observer = elementObservers().take(element); 77 CustomElementObserver* observer = elementObservers().take(element);
67 ASSERT_UNUSED(observer, observer == this); 78 ASSERT_UNUSED(observer, observer == this);
68 } 79 }
69 80
70 } // namespace WebCore 81 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698