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

Side by Side Diff: Source/core/dom/custom/CustomElementUpgradeCandidateMap.h

Issue 296703009: Oilpan: move custom element objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 24 matching lines...) Expand all
35 #include "core/dom/custom/CustomElementDescriptorHash.h" 35 #include "core/dom/custom/CustomElementDescriptorHash.h"
36 #include "core/dom/custom/CustomElementObserver.h" 36 #include "core/dom/custom/CustomElementObserver.h"
37 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
38 #include "wtf/ListHashSet.h" 38 #include "wtf/ListHashSet.h"
39 #include "wtf/Noncopyable.h" 39 #include "wtf/Noncopyable.h"
40 40
41 namespace WebCore { 41 namespace WebCore {
42 42
43 class Element; 43 class Element;
44 44
45 class CustomElementUpgradeCandidateMap : CustomElementObserver { 45 class CustomElementUpgradeCandidateMap FINAL : public CustomElementObserver {
46 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); 46 WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap);
47 public: 47 public:
48 CustomElementUpgradeCandidateMap() { } 48 static PassOwnPtrWillBeRawPtr<CustomElementUpgradeCandidateMap> create();
49 ~CustomElementUpgradeCandidateMap(); 49 virtual ~CustomElementUpgradeCandidateMap();
50 50
51 // API for CustomElementRegistrationContext to save and take candidates 51 // API for CustomElementRegistrationContext to save and take candidates
52 52
53 typedef ListHashSet<Element*> ElementSet; 53 typedef WillBeHeapListHashSet<RawPtrWillBeMember<Element> > ElementSet;
54 54
55 void add(const CustomElementDescriptor&, Element*); 55 void add(const CustomElementDescriptor&, Element*);
56 void remove(Element*); 56 void remove(Element*);
57 ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&); 57 ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&);
58 58
59 virtual void trace(Visitor*) OVERRIDE;
60
59 private: 61 private:
62 CustomElementUpgradeCandidateMap() { }
63
60 virtual void elementWasDestroyed(Element*) OVERRIDE; 64 virtual void elementWasDestroyed(Element*) OVERRIDE;
61 void removeCommon(Element*); 65 void removeCommon(Element*);
62 66
63 virtual void elementDidFinishParsingChildren(Element*) OVERRIDE; 67 virtual void elementDidFinishParsingChildren(Element*) OVERRIDE;
64 void moveToEnd(Element*); 68 void moveToEnd(Element*);
65 69
66 typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap; 70 typedef WillBeHeapHashMap<RawPtrWillBeMember<Element>, CustomElementDescript or> UpgradeCandidateMap;
haraken 2014/05/22 08:24:10 Shouldn't the key Element be a weak member?
Mads Ager (chromium) 2014/05/22 08:33:27 Will the m_upgradeCandidates map always end up emp
67 UpgradeCandidateMap m_upgradeCandidates; 71 UpgradeCandidateMap m_upgradeCandidates;
68 72
69 typedef HashMap<CustomElementDescriptor, ElementSet> UnresolvedDefinitionMap ; 73 typedef WillBeHeapHashMap<CustomElementDescriptor, ElementSet> UnresolvedDef initionMap;
haraken 2014/05/22 08:24:10 This looks OK. The ElementSet can be a hash set of
wibling-chromium 2014/05/22 09:06:05 I cannot find where this is explicitly cleared? Th
sof 2014/05/25 16:30:01 Whether or not to use weak references in ElementSe
70 UnresolvedDefinitionMap m_unresolvedDefinitions; 74 UnresolvedDefinitionMap m_unresolvedDefinitions;
71 }; 75 };
72 76
73 } 77 }
74 78
75 #endif // CustomElementUpgradeCandidateMap_h 79 #endif // CustomElementUpgradeCandidateMap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698