Move towards supporting user controlled prototypes on CanvasPixelArray
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Aug 2011 00:08:26 +0000 (00:08 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Aug 2011 00:08:26 +0000 (00:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=66429

Reviewed by Gavin Barraclough.

Start using a per-global object structure for canvas pixel array.

* bindings/js/JSImageDataCustom.cpp:
(WebCore::toJS):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSImageDataCustom.cpp

index 99ec366..c9ac98f 100644 (file)
@@ -1,3 +1,15 @@
+2011-08-17  Oliver Hunt  <oliver@apple.com>
+
+        Move towards supporting user controlled prototypes on CanvasPixelArray
+        https://bugs.webkit.org/show_bug.cgi?id=66429
+
+        Reviewed by Gavin Barraclough.
+
+        Start using a per-global object structure for canvas pixel array.
+
+        * bindings/js/JSImageDataCustom.cpp:
+        (WebCore::toJS):
+
 2011-08-17  Luke Macpherson   <macpherson@chromium.org>
 
         Support cast from CSSPrimitiveValue to unsigned, and use in appropriate places in CSSStyleSelector::applyProperty
index ddbef53..a86be81 100644 (file)
@@ -48,8 +48,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageD
     wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ImageData, imageData);
     Identifier dataName(exec, "data");
     static const ClassInfo cpaClassInfo = { "CanvasPixelArray", &JSByteArray::Base::s_info, 0, 0 };
-    DEFINE_STATIC_LOCAL(Strong<Structure>, cpaStructure, (exec->globalData(), JSByteArray::createStructure(exec->globalData(), jsNull(), &cpaClassInfo)));
-    wrapper->putDirect(exec->globalData(), dataName, JSByteArray::create(exec, cpaStructure.get(), imageData->data()->data()), DontDelete | ReadOnly);
+    Structure* cpaStructure = getCachedDOMStructure(globalObject, &cpaClassInfo);
+    if (!cpaStructure)
+        cpaStructure = cacheDOMStructure(globalObject, JSByteArray::createStructure(exec->globalData(), jsNull(), &cpaClassInfo), &cpaClassInfo);
+    wrapper->putDirect(exec->globalData(), dataName, JSByteArray::create(exec, cpaStructure, imageData->data()->data()), DontDelete | ReadOnly);
     exec->heap()->reportExtraMemoryCost(imageData->data()->length());
     
     return wrapper;