diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/bindings/js/JSImageDataCustom.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/bindings/js/JSImageDataCustom.cpp')
-rw-r--r-- | Source/WebCore/bindings/js/JSImageDataCustom.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Source/WebCore/bindings/js/JSImageDataCustom.cpp b/Source/WebCore/bindings/js/JSImageDataCustom.cpp index 1576d5e58..518b5ef13 100644 --- a/Source/WebCore/bindings/js/JSImageDataCustom.cpp +++ b/Source/WebCore/bindings/js/JSImageDataCustom.cpp @@ -26,7 +26,10 @@ #include "config.h" #include "JSImageData.h" -#include "ImageData.h" +#include "JSDOMConvertBufferSource.h" +#include "JSDOMWrapperCache.h" +#include <heap/HeapInlines.h> +#include <runtime/IdentifierInlines.h> #include <wtf/StdLibExtras.h> #include <wtf/text/WTFString.h> @@ -34,21 +37,22 @@ using namespace JSC; namespace WebCore { -JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, ImageData* imageData) +JSValue toJSNewlyCreated(ExecState* state, JSDOMGlobalObject* globalObject, Ref<ImageData>&& imageData) { - if (!imageData) - return jsNull(); - - JSObject* wrapper = getCachedWrapper(currentWorld(exec), imageData); - if (wrapper) - return wrapper; - - wrapper = CREATE_DOM_WRAPPER(exec, globalObject, ImageData, imageData); - Identifier dataName(exec, "data"); - wrapper->putDirect(exec->vm(), dataName, toJS(exec, globalObject, imageData->data()), DontDelete | ReadOnly); - exec->heap()->reportExtraMemoryCost(imageData->data()->length()); + auto* data = imageData->data(); + auto* wrapper = createWrapper<ImageData>(globalObject, WTFMove(imageData)); + Identifier dataName = Identifier::fromString(state, "data"); + wrapper->putDirect(state->vm(), dataName, toJS(state, globalObject, data), DontDelete | ReadOnly); + // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated. + // https://bugs.webkit.org/show_bug.cgi?id=142595 + state->heap()->deprecatedReportExtraMemory(data->length()); return wrapper; } +JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, ImageData& imageData) +{ + return wrap(state, globalObject, imageData); +} + } |