Changeset 133633 in webkit
- Timestamp:
- Nov 6, 2012 10:19:48 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r133632 r133633 1 2012-11-06 Adam Barth <abarth@webkit.org> 2 3 ScriptWrappable should work for more than just Node 4 https://bugs.webkit.org/show_bug.cgi?id=101319 5 6 Reviewed by Eric Seidel. 7 8 This patch generalizes the inline cached wrapper code path to work with 9 all subclasses of ScriptWrappable, not just Node. 10 11 * bindings/js/JSDOMBinding.h: 12 (WebCore::setInlineCachedWrapper): 13 (WebCore::getInlineCachedWrapper): 14 (WebCore): 15 (WebCore::clearInlineCachedWrapper): 16 (WebCore::cacheWrapper): 17 * bindings/js/JSNodeCustom.h: 18 1 19 2012-11-06 Tiancheng Jiang <tijiang@rim.com> 2 20 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r129779 r133633 33 33 #include "Element.h" 34 34 #include "MediaList.h" 35 #include "ScriptWrappable.h" 35 36 #include "StylePropertySet.h" 36 37 #include "StyledElement.h" … … 130 131 } 131 132 132 // Overload these functions to provide a fast path for wrapper access.133 133 inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld*, void*) { return 0; } 134 inline bool setInlineCachedWrapper(DOMWrapperWorld*, void*, JSDOMWrapper* ) { return false; }134 inline bool setInlineCachedWrapper(DOMWrapperWorld*, void*, JSDOMWrapper*, JSC::WeakHandleOwner*, void*) { return false; } 135 135 inline bool clearInlineCachedWrapper(DOMWrapperWorld*, void*, JSDOMWrapper*) { return false; } 136 137 inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld* world, ScriptWrappable* domObject) 138 { 139 if (!world->isNormal()) 140 return 0; 141 return domObject->wrapper(); 142 } 143 144 inline bool setInlineCachedWrapper(DOMWrapperWorld* world, ScriptWrappable* domObject, JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context) 145 { 146 if (!world->isNormal()) 147 return false; 148 domObject->setWrapper(*world->globalData(), wrapper, wrapperOwner, context); 149 return true; 150 } 151 152 inline bool clearInlineCachedWrapper(DOMWrapperWorld* world, ScriptWrappable* domObject, JSDOMWrapper* wrapper) 153 { 154 if (!world->isNormal()) 155 return false; 156 domObject->clearWrapper(wrapper); 157 return true; 158 } 136 159 137 160 template <typename DOMClass> inline JSDOMWrapper* getCachedWrapper(DOMWrapperWorld* world, DOMClass* domObject) … … 144 167 template <typename DOMClass> inline void cacheWrapper(DOMWrapperWorld* world, DOMClass* domObject, JSDOMWrapper* wrapper) 145 168 { 146 if (setInlineCachedWrapper(world, domObject, wrapper)) 169 JSC::WeakHandleOwner* owner = wrapperOwner(world, domObject); 170 void* context = wrapperContext(world, domObject); 171 if (setInlineCachedWrapper(world, domObject, wrapper, owner, context)) 147 172 return; 148 JSC::PassWeak<JSDOMWrapper> passWeak(wrapper, wrapperOwner(world, domObject), wrapperContext(world, domObject));173 JSC::PassWeak<JSDOMWrapper> passWeak(wrapper, owner, context); 149 174 weakAdd(world->m_wrappers, (void*)domObject, passWeak); 150 175 } -
trunk/Source/WebCore/bindings/js/JSNodeCustom.h
r130611 r133633 33 33 namespace WebCore { 34 34 35 inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld* world, Node* node)36 {37 if (!world->isNormal())38 return 0;39 return node->wrapper();40 }41 42 inline bool setInlineCachedWrapper(DOMWrapperWorld* world, Node* node, JSDOMWrapper* wrapper)43 {44 if (!world->isNormal())45 return false;46 node->setWrapper(*world->globalData(), wrapper, wrapperOwner(world, node), wrapperContext(world, node));47 return true;48 }49 50 inline bool clearInlineCachedWrapper(DOMWrapperWorld* world, Node* node, JSDOMWrapper* wrapper)51 {52 if (!world->isNormal())53 return false;54 node->clearWrapper(wrapper);55 return true;56 }57 58 35 JSC::JSValue createWrapper(JSC::ExecState*, JSDOMGlobalObject*, Node*); 59 36
Note: See TracChangeset
for help on using the changeset viewer.