Changeset 73119 in webkit
- Timestamp:
- Dec 2, 2010 2:40:07 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r73118 r73119 1 2010-12-02 Yuqiang Xian <yuqiang.xian@intel.com> 2 3 Reviewed by Pavel Feldman. 4 5 [V8] Speed up data property access for ImageData. 6 https://bugs.webkit.org/show_bug.cgi?id=49999 7 8 We create a normal V8 object which has a PixelArray as the backing storage, 9 and set the "data" property of the ImageData object to it. 10 This way "data" becomes a pure JS property and we don't need to call through 11 the C++ bindings for ImageData "data" access. 12 This eliminates big overhead in switching between JavaScript and native 13 contexts and performing object bindings. 14 15 No new tests. Relying on existing Canvas tests. 16 17 * WebCore.gypi: 18 * bindings/scripts/CodeGeneratorV8.pm: 19 * bindings/v8/custom/V8CanvasPixelArrayCustom.cpp: 20 (WebCore::toV8): 21 * bindings/v8/custom/V8ImageDataCustom.cpp: Added. 22 (WebCore::toV8): 23 * html/ImageData.idl: 24 * html/canvas/CanvasPixelArray.idl: 25 1 26 2010-12-02 Kent Tamura <tkent@chromium.org> 2 27 -
trunk/WebCore/WebCore.gypi
r73011 r73119 748 748 'bindings/v8/OptionsObject.cpp', 749 749 'bindings/v8/OptionsObject.h', 750 'bindings/v8/custom/V8ImageDataCustom.cpp', 750 751 'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp', 751 752 'bindings/v8/custom/V8ArrayBufferViewCustom.h', -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r73011 r73119 2529 2529 return 0 if $interfaceName eq "AbstractWorker"; 2530 2530 return 0 if $interfaceName eq "CanvasRenderingContext"; 2531 return 0 if $interfaceName eq "ImageData";2532 2531 return 0 if $interfaceName eq "SVGElementInstance"; 2533 2532 -
trunk/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp
r54153 r73119 39 39 return v8::Null(); 40 40 v8::Handle<v8::Object> wrapper = V8CanvasPixelArray::wrap(impl); 41 if (!wrapper.IsEmpty()) 41 if (!wrapper.IsEmpty()) { 42 42 wrapper->SetIndexedPropertiesToPixelData(impl->data()->data(), impl->length()); 43 wrapper->Set(v8::String::NewSymbol("length"), 44 v8::Integer::New(impl->length()), 45 v8::ReadOnly); 46 } 43 47 return wrapper; 44 48 } -
trunk/WebCore/bindings/v8/custom/V8ImageDataCustom.cpp
r73118 r73119 30 30 31 31 #include "config.h" 32 #include "V8ImageData.h" 33 32 34 #include "V8CanvasPixelArray.h" 33 35 34 36 namespace WebCore { 35 37 36 v8::Handle<v8::Value> toV8( CanvasPixelArray* impl)38 v8::Handle<v8::Value> toV8(ImageData* impl) 37 39 { 38 40 if (!impl) 39 41 return v8::Null(); 40 v8::Handle<v8::Object> wrapper = V8CanvasPixelArray::wrap(impl); 41 if (!wrapper.IsEmpty()) 42 wrapper->SetIndexedPropertiesToPixelData(impl->data()->data(), impl->length()); 42 v8::Handle<v8::Object> wrapper = V8ImageData::wrap(impl); 43 if (!wrapper.IsEmpty()) { 44 // Create a V8 CanvasPixelArray object. 45 v8::Handle<v8::Value> pixelArray = toV8(impl->data()); 46 // Set the "data" property of the ImageData object to 47 // the created v8 object, eliminating the C++ callback 48 // when accessing the "data" property. 49 if (!pixelArray.IsEmpty()) { 50 wrapper->Set(v8::String::NewSymbol("data"), 51 pixelArray, 52 v8::ReadOnly); 53 } 54 } 55 43 56 return wrapper; 44 57 } -
trunk/WebCore/html/ImageData.idl
r52537 r73119 34 34 readonly attribute long width; 35 35 readonly attribute long height; 36 #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT || defined(V8_BINDING) && V8_BINDING36 #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT 37 37 readonly attribute CanvasPixelArray data; 38 38 #endif -
trunk/WebCore/html/canvas/CanvasPixelArray.idl
r52534 r73119 35 35 HasCustomIndexSetter 36 36 ] CanvasPixelArray { 37 #if !defined(V8_BINDING) || !V8_BINDING 37 38 readonly attribute long length; 39 #endif 38 40 }; 39 41 #endif
Note: See TracChangeset
for help on using the changeset viewer.