Summary: | better V8 bindings for HTML5 ImageData | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Yuqiang Xian <yuqiang.xian> | ||||||||||||
Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | antonm, commit-queue, iposva, peter, pfeldman, vitalyr, webkit.review.bot | ||||||||||||
Priority: | P2 | ||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||
Hardware: | PC | ||||||||||||||
OS: | All | ||||||||||||||
Attachments: |
|
Description
Yuqiang Xian
2010-11-23 18:17:04 PST
Created attachment 74714 [details]
proposed patch
(In reply to comment #1) > Created an attachment (id=74714) [details] > proposed patch The key part here is avoiding hitting a C++ callback when reading the "data" property on a JS wrapper of ImageData object. Setting a pure JS property on the wrapper is a good idea. Yet modifying the way the value of the property is computed is not necessary and I think can be only harmful. Instead of creating a new object template and instantiating it, we should reuse the CanvasPixelArray wraper, i.e. do something like this: if (!wrapper.IsEmpty()) { v8::Handle<v8::Value> pixelArray = toV8(impl->data()); if (!pixelArray.IsEmpty()) wrapper->Set(v8::String::NewSymbol("data"), pixelArray, v8::ReadOnly); } Created attachment 74821 [details]
updated patch
Vitaly, thanks for the comments.
I agree with you. And here's the updated patch. Please help review it.
BTW, I also set the "length" property of CanvasPixelArray to be a pure V8 object.
Attachment 74821 [details] did not pass style-queue:
Failed to run "['WebKitTools/Scripts/check-webkit-style', '--diff-files', u'WebCore/ChangeLog', u'WebCore/WebCore.gypi', u'WebCore/bindings/scripts/CodeGeneratorV8.pm', u'WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp', u'WebCore/bindings/v8/custom/V8ImageDataCustom.cpp', u'WebCore/html/ImageData.idl', u'WebCore/html/canvas/CanvasPixelArray.idl']" exit_code: 1
WebCore/bindings/v8/custom/V8ImageDataCustom.cpp:32: Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4]
WebCore/bindings/v8/custom/V8ImageDataCustom.cpp:33: Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted. [build/include_order] [4]
Total errors found: 2 in 6 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Created attachment 74823 [details]
updated patch
resolve the style issue.
Looks good. A few nits: o After "Reviewed by" line in the change log add a short one-line summary: "[V8] Speed up data property access for ImageData." o Update the rest of the change log description to emphasize the fact that pure JS properties are used. o Comments in code should be formatted like sentences, starting with a capital letter. o Typo: "elimnating" -> "eliminating". After these are done you'll need a WebKit reviewer to set r+ (I can'd to this yet). Pavel (cc'ed) agreed to help. Comment on attachment 74823 [details]
updated patch
Rubber stamping so that you could land it once Vitaly's comments are addressed.
Created attachment 74894 [details]
updated patch
Thanks for the comments, Vitaly.
Here's the updated patch addressing your comments.
Thanks, -Yuqiang
Comment on attachment 74894 [details] updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=74894&action=review > WebCore/ChangeLog:13 > + https://bugs.webkit.org/show_bug.cgi?id=49999 Nit: bug reference should follow the commit title, before the blank line. [Title] [bug link] <blank line> [Discription] Comment on attachment 74823 [details] updated patch Cleared Pavel Feldman's review+ from obsolete attachment 74823 [details] so that this bug does not appear in http://webkit.org/pending-commit. Created attachment 75103 [details]
updated patch
Update the patch addressing Pavel's comment.
Thanks, -Yuqiang
The commit-queue encountered the following flaky tests while processing attachment 75103 [details]: http/tests/media/video-load-twice.html Please file bugs against the tests. These tests were authored by eric.carlson@apple.com and hclam@google.com. The commit-queue is continuing to process your patch. Comment on attachment 75103 [details] updated patch Clearing flags on attachment: 75103 Committed r73119: <http://trac.webkit.org/changeset/73119> All reviewed patches have been landed. Closing bug. |