Changeset 84309 in webkit
- Timestamp:
- Apr 19, 2011 4:32:39 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r84307 r84309 1 2011-04-19 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 Removed a use of markDOMObjectWrapper: NodeLists 6 https://bugs.webkit.org/show_bug.cgi?id=58939 7 8 * bindings/js/JSDocumentCustom.cpp: 9 (WebCore::JSDocument::markChildren): No need to mark node lists, because 10 now they use the opaque roots system to decide their lifetimes. 11 12 * bindings/js/JSNamedNodeMapCustom.cpp: Removed stray newline. 13 14 * bindings/js/JSNodeListCustom.cpp: 15 (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots): 16 (WebCore::JSNodeListOwner::finalize): 17 (WebCore::wrapperOwner): 18 (WebCore::wrapperContext): 19 (WebCore::toJS): Use the opaque roots system to avoid relying on 20 markDOMObjectWrapper. 21 22 * dom/DynamicNodeList.cpp: 23 (WebCore::DynamicNodeList::isDynamicNodeList): 24 * dom/DynamicNodeList.h: 25 (WebCore::DynamicNodeList::rootNode): Added the ability to get the node 26 backing a NodeList, for use in the opaque roots system. 27 28 * dom/Node.cpp: 29 * dom/Node.h: 30 * dom/NodeList.h: 31 (WebCore::NodeList::isDynamicNodeList): Ditto. Removed cruft related 32 to the old way of marking NodeLists. 33 34 * dom/NodeList.idl: We need a custom toJS so we can specify a custom 35 WeakHandleOwner at construction time. 36 1 37 2011-04-19 Antoine Labour <piman@chromium.org> 2 38 -
trunk/Source/WebCore/bindings/js/JSDocumentCustom.cpp
r84194 r84309 59 59 markDOMObjectWrapper(markStack, globalData, document->implementation()); 60 60 markDOMObjectWrapper(markStack, globalData, document->styleSheets()); 61 document->markCachedNodeLists(markStack, globalData);62 61 } 63 62 -
trunk/Source/WebCore/bindings/js/JSNamedNodeMapCustom.cpp
r84194 r84309 28 28 29 29 #include "JSNode.h" 30 31 30 #include "Element.h" 32 31 #include "NamedNodeMap.h" -
trunk/Source/WebCore/bindings/js/JSNodeListCustom.cpp
r65588 r84309 27 27 #include "JSNodeList.h" 28 28 29 #include "DynamicNodeList.h" 29 30 #include "JSNode.h" 30 31 #include "Node.h" … … 35 36 36 37 namespace WebCore { 38 39 class JSNodeListOwner : public JSC::WeakHandleOwner { 40 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 41 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); 42 }; 43 44 bool JSNodeListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, MarkStack& markStack) 45 { 46 JSNodeList* jsNodeList = static_cast<JSNodeList*>(handle.get().asCell()); 47 if (!jsNodeList->hasCustomProperties()) 48 return false; 49 if (!jsNodeList->impl()->isDynamicNodeList()) 50 return false; 51 return markStack.containsOpaqueRoot(root(static_cast<DynamicNodeList*>(jsNodeList->impl())->rootNode())); 52 } 53 54 void JSNodeListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) 55 { 56 JSNodeList* jsNodeList = static_cast<JSNodeList*>(handle.get().asCell()); 57 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); 58 uncacheWrapper(world, jsNodeList->impl(), jsNodeList); 59 } 60 61 inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, NodeList*) 62 { 63 DEFINE_STATIC_LOCAL(JSNodeListOwner, jsNodeListOwner, ()); 64 return &jsNodeListOwner; 65 } 66 67 inline void* wrapperContext(DOMWrapperWorld* world, NodeList*) 68 { 69 return world; 70 } 71 72 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, NodeList* impl) 73 { 74 return wrap<JSNodeList>(exec, globalObject, impl); 75 } 37 76 38 77 // Need to support call so that list(0) works. -
trunk/Source/WebCore/dom/DynamicNodeList.cpp
r69868 r84309 146 146 } 147 147 148 bool DynamicNodeList::isDynamicNodeList() const 149 { 150 return true; 151 } 152 148 153 void DynamicNodeList::invalidateCache() 149 154 { -
trunk/Source/WebCore/dom/DynamicNodeList.h
r65021 r84309 61 61 // Other methods (not part of DOM) 62 62 void invalidateCache(); 63 Node* rootNode() const { return m_rootNode.get(); } 63 64 64 65 protected: … … 73 74 74 75 private: 76 virtual bool isDynamicNodeList() const; 75 77 Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; 76 78 Node* itemBackwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; -
trunk/Source/WebCore/dom/Node.cpp
r84251 r84309 2652 2652 } 2653 2653 2654 #if USE(JSC)2655 2656 template <class NodeListMap>2657 void markNodeLists(const NodeListMap& map, JSC::MarkStack& markStack, JSC::JSGlobalData& globalData)2658 {2659 for (typename NodeListMap::const_iterator it = map.begin(); it != map.end(); ++it)2660 markDOMObjectWrapper(markStack, globalData, it->second);2661 }2662 2663 void Node::markCachedNodeListsSlow(JSC::MarkStack& markStack, JSC::JSGlobalData& globalData)2664 {2665 NodeListsNodeData* nodeLists = rareData()->nodeLists();2666 if (!nodeLists)2667 return;2668 2669 markNodeLists(nodeLists->m_classNodeListCache, markStack, globalData);2670 markNodeLists(nodeLists->m_nameNodeListCache, markStack, globalData);2671 markNodeLists(nodeLists->m_tagNodeListCache, markStack, globalData);2672 }2673 2674 #endif2675 2676 2654 void Node::handleLocalEvents(Event* event) 2677 2655 { -
trunk/Source/WebCore/dom/Node.h
r84251 r84309 573 573 virtual EventTargetData* ensureEventTargetData(); 574 574 575 #if USE(JSC)576 void markCachedNodeLists(JSC::MarkStack& markStack, JSC::JSGlobalData& globalData)577 {578 // NodeLists may be present. If so, they need to be marked.579 if (!hasRareData())580 return;581 582 markCachedNodeListsSlow(markStack, globalData);583 }584 #endif585 586 575 private: 587 576 enum NodeFlags { … … 666 655 667 656 private: 668 #if USE(JSC)669 void markCachedNodeListsSlow(JSC::MarkStack&, JSC::JSGlobalData&);670 #endif671 672 657 enum EditableLevel { Editable, RichlyEditable }; 673 658 bool rendererIsEditable(EditableLevel) const; -
trunk/Source/WebCore/dom/NodeList.h
r65021 r84309 40 40 virtual Node* item(unsigned index) const = 0; 41 41 virtual Node* itemWithName(const AtomicString&) const = 0; 42 43 // Other methods (not part of DOM) 44 virtual bool isDynamicNodeList() const { return false; } 42 45 }; 43 46 -
trunk/Source/WebCore/dom/NodeList.idl
r52921 r84309 22 22 23 23 interface [ 24 CustomToJS, 24 25 HasIndexGetter, 25 26 HasNameGetter,
Note: See TracChangeset
for help on using the changeset viewer.