Changeset 84021 in webkit
- Timestamp:
- Apr 15, 2011 12:55:54 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r83997 r84021 1 2011-04-14 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Make JSNodeFilterCondition handle its lifetime correctly 6 https://bugs.webkit.org/show_bug.cgi?id=58622 7 8 Add export 9 10 * JavaScriptCore.exp: 11 1 12 2011-04-14 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/Source/JavaScriptCore/JavaScriptCore.exp
r83955 r84021 170 170 __ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE 171 171 __ZN3JSC15WeakHandleOwner26isReachableFromOpaqueRootsENS_6HandleINS_7UnknownEEEPvRNS_9MarkStackE 172 __ZN3JSC15WeakHandleOwner8finalizeENS_6HandleINS_7UnknownEEEPv 172 173 __ZN3JSC15WeakHandleOwnerD2Ev 173 174 __ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r83974 r84021 665 665 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 666 666 proxyType = 2; 667 remoteGlobalIDString = 4539C8FF0EC27F6400A70F4C /* gtest.framework */;667 remoteGlobalIDString = 4539C8FF0EC27F6400A70F4C; 668 668 remoteInfo = "gtest-framework"; 669 669 }; … … 672 672 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 673 673 proxyType = 2; 674 remoteGlobalIDString = 40C848FA101A209C0083642A /* libgtest.a */;674 remoteGlobalIDString = 40C848FA101A209C0083642A; 675 675 remoteInfo = "gtest-static"; 676 676 }; … … 679 679 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 680 680 proxyType = 2; 681 remoteGlobalIDString = 40C8490B101A217E0083642A /* libgtest_main.a */;681 remoteGlobalIDString = 40C8490B101A217E0083642A; 682 682 remoteInfo = "gtest_main-static"; 683 683 }; … … 686 686 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 687 687 proxyType = 2; 688 remoteGlobalIDString = 40899F430FFA7184000B29AE /* gtest_unittest-framework */;688 remoteGlobalIDString = 40899F430FFA7184000B29AE; 689 689 remoteInfo = "gtest_unittest-framework"; 690 690 }; … … 693 693 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 694 694 proxyType = 2; 695 remoteGlobalIDString = 40C84987101A36850083642A /* gtest_unittest */;695 remoteGlobalIDString = 40C84987101A36850083642A; 696 696 remoteInfo = "gtest_unittest-static"; 697 697 }; … … 700 700 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 701 701 proxyType = 2; 702 remoteGlobalIDString = 4089A0130FFACEFC000B29AE /* sample1_unittest-framework */;702 remoteGlobalIDString = 4089A0130FFACEFC000B29AE; 703 703 remoteInfo = "sample1_unittest-framework"; 704 704 }; … … 707 707 containerPortal = F33EE0D3135678CA00E09E65 /* gtest.xcodeproj */; 708 708 proxyType = 2; 709 remoteGlobalIDString = 40C84997101A36A60083642A /* sample1_unittest-static */;709 remoteGlobalIDString = 40C84997101A36A60083642A; 710 710 remoteInfo = "sample1_unittest-static"; 711 711 }; -
trunk/Source/WebCore/ChangeLog
r84018 r84021 1 2011-04-14 Oliver Hunt <oliver@apple.com> 2 3 Reviewed by Geoffrey Garen. 4 5 Make JSNodeFilterCondition handle its lifetime correctly 6 https://bugs.webkit.org/show_bug.cgi?id=58622 7 8 Switch over to a WeakHandle and external roots to keep the 9 condition value live. 10 11 * bindings/js/JSNodeFilterCondition.cpp: 12 (WebCore::JSNodeFilterCondition::JSNodeFilterCondition): 13 (WebCore::JSNodeFilterCondition::markAggregate): 14 (WebCore::JSNodeFilterCondition::acceptNode): 15 (WebCore::JSNodeFilterCondition::WeakOwner::isReachableFromOpaqueRoots): 16 * bindings/js/JSNodeFilterCondition.h: 17 (WebCore::JSNodeFilterCondition::create): 18 * bindings/js/JSNodeFilterCustom.cpp: 19 (WebCore::toNodeFilter): 20 * bindings/scripts/CodeGeneratorJS.pm: 21 1 22 2011-04-13 Luiz Agostini <luiz.agostini@openbossa.org> 2 23 -
trunk/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp
r77151 r84021 33 33 ASSERT_CLASS_FITS_IN_CELL(JSNodeFilterCondition); 34 34 35 JSNodeFilterCondition::JSNodeFilterCondition(JS Value filter)36 : m_filter( filter)35 JSNodeFilterCondition::JSNodeFilterCondition(JSGlobalData& globalData, NodeFilter* owner, JSValue filter) 36 : m_filter(globalData, filter, &m_weakOwner, owner) 37 37 { 38 }39 40 void JSNodeFilterCondition::markAggregate(MarkStack& markStack)41 {42 markStack.append(&m_filter);43 38 } 44 39 … … 47 42 JSLock lock(SilenceAssertionsOnly); 48 43 49 if (!m_filter ->isObject())44 if (!m_filter.isObject()) 50 45 return NodeFilter::FILTER_ACCEPT; 51 46 … … 63 58 CallType callType = getCallData(function, callData); 64 59 if (callType == CallTypeNone) { 65 function = m_filter ->get(exec, Identifier(exec, "acceptNode"));60 function = m_filter.get().get(exec, Identifier(exec, "acceptNode")); 66 61 callType = getCallData(function, callData); 67 62 if (callType == CallTypeNone) { … … 89 84 } 90 85 86 bool JSNodeFilterCondition::WeakOwner::isReachableFromOpaqueRoots(JSC::Handle<Unknown>, void* context, MarkStack& markStack) 87 { 88 return markStack.containsOpaqueRoot(context); 89 } 90 91 91 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSNodeFilterCondition.h
r77151 r84021 22 22 23 23 #include "NodeFilterCondition.h" 24 #include <heap/Weak.h> 24 25 #include <runtime/JSValue.h> 25 26 #include <wtf/PassRefPtr.h> … … 28 29 29 30 class Node; 31 class NodeFilter; 30 32 31 33 class JSNodeFilterCondition : public NodeFilterCondition { 32 34 public: 33 static PassRefPtr<JSNodeFilterCondition> create(JSC::JS Value filter)35 static PassRefPtr<JSNodeFilterCondition> create(JSC::JSGlobalData& globalData, NodeFilter* owner, JSC::JSValue filter) 34 36 { 35 return adoptRef(new JSNodeFilterCondition( filter));37 return adoptRef(new JSNodeFilterCondition(globalData, owner, filter)); 36 38 } 37 39 38 40 private: 39 JSNodeFilterCondition(JSC::JS Value filter);41 JSNodeFilterCondition(JSC::JSGlobalData&, NodeFilter* owner, JSC::JSValue filter); 40 42 41 43 virtual short acceptNode(ScriptState*, Node*) const; 42 virtual void markAggregate(JSC::MarkStack&);43 44 44 mutable JSC::DeprecatedPtr<JSC::Unknown> m_filter; 45 class WeakOwner : public JSC::WeakHandleOwner { 46 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::MarkStack&); 47 }; 48 WeakOwner m_weakOwner; 49 mutable JSC::Weak<JSC::Unknown> m_filter; 45 50 }; 46 51 -
trunk/Source/WebCore/bindings/js/JSNodeFilterCustom.cpp
r77151 r84021 40 40 { 41 41 Base::markChildren(markStack); 42 impl()->markAggregate(markStack);42 markStack.addOpaqueRoot(impl()); 43 43 } 44 44 45 PassRefPtr<NodeFilter> toNodeFilter(JS Value value)45 PassRefPtr<NodeFilter> toNodeFilter(JSGlobalData& globalData, JSValue value) 46 46 { 47 47 if (value.inherits(&JSNodeFilter::s_info)) 48 48 return static_cast<JSNodeFilter*>(asObject(value))->impl(); 49 49 50 return NodeFilter::create(JSNodeFilterCondition::create(value)); 50 RefPtr<NodeFilter> result = NodeFilter::create(); 51 result->setCondition(JSNodeFilterCondition::create(globalData, result.get(), value)); 52 return result.release(); 51 53 } 52 54 -
trunk/Source/WebCore/bindings/js/JSNodeIteratorCustom.cpp
r58333 r84021 35 35 36 36 if (NodeFilter* filter = m_impl->filter()) 37 filter->markAggregate(markStack);37 markStack.addOpaqueRoot(filter); 38 38 } 39 39 -
trunk/Source/WebCore/bindings/js/JSTreeWalkerCustom.cpp
r58298 r84021 35 35 36 36 if (NodeFilter* filter = m_impl->filter()) 37 filter->markAggregate(markStack);37 markStack.addOpaqueRoot(filter); 38 38 } 39 39 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r83955 r84021 924 924 if (!$hasParent || $dataNode->extendedAttributes->{"GenerateNativeConverter"}) { 925 925 if ($interfaceName eq "NodeFilter") { 926 push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JS Value);\n");926 push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JSGlobalData&, JSC::JSValue);\n"); 927 927 } else { 928 928 push(@headerContent, "$implType* to${interfaceName}(JSC::JSValue);\n"); … … 2467 2467 } 2468 2468 2469 if ($type eq "NodeFilter") { 2470 $implIncludes{"JS$type.h"} = 1; 2471 return "to$type(exec->globalData(), $value)"; 2472 } 2473 2469 2474 if ($type eq "MediaQueryListListener") { 2470 2475 $implIncludes{"MediaQueryListListener.h"} = 1; -
trunk/Source/WebCore/dom/NodeFilter.h
r71515 r84021 71 71 } 72 72 73 static PassRefPtr<NodeFilter> create() 74 { 75 return adoptRef(new NodeFilter()); 76 } 77 73 78 short acceptNode(ScriptState*, Node*) const; 74 void markAggregate(JSC::MarkStack& markStack) { m_condition->markAggregate(markStack); };75 79 76 80 // Do not call these functions. They are just scaffolding to support the Objective-C bindings. 77 81 // They operate in the main thread normal world, and they swallow JS exceptions. 78 82 short acceptNode(Node* node) const { return acceptNode(scriptStateFromNode(mainThreadNormalWorld(), node), node); } 83 84 void setCondition(PassRefPtr<NodeFilterCondition> condition) { ASSERT(!m_condition); m_condition = condition; } 79 85 80 86 private: 81 87 NodeFilter(PassRefPtr<NodeFilterCondition> condition) : m_condition(condition) { } 88 NodeFilter() {} 82 89 83 90 RefPtr<NodeFilterCondition> m_condition;
Note: See TracChangeset
for help on using the changeset viewer.