Bug 40854 - JSC bindings for Image Resizer API
Summary: JSC bindings for Image Resizer API
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 39905
  Show dependency treegraph
 
Reported: 2010-06-18 13:32 PDT by Sterling Swigart
Modified: 2010-06-24 16:41 PDT (History)
9 users (show)

See Also:


Attachments
Patch 2: JSC bindings (101.62 KB, patch)
2010-06-18 13:53 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (102.69 KB, patch)
2010-06-18 14:05 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (112.32 KB, patch)
2010-06-18 16:00 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (112.32 KB, patch)
2010-06-18 16:05 PDT, Sterling Swigart
abarth: review-
abarth: commit-queue-
Details | Formatted Diff | Diff
Patch 2: JSC bindings (95.51 KB, patch)
2010-06-21 18:19 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (95.42 KB, patch)
2010-06-22 10:01 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (95.56 KB, patch)
2010-06-22 10:38 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.91 KB, patch)
2010-06-22 14:12 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (95.42 KB, patch)
2010-06-22 18:12 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.65 KB, patch)
2010-06-22 19:20 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.31 KB, patch)
2010-06-22 19:34 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.35 KB, patch)
2010-06-22 19:55 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.48 KB, patch)
2010-06-22 21:43 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (94.48 KB, patch)
2010-06-22 21:57 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (235.50 KB, patch)
2010-06-22 22:27 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (286.97 KB, patch)
2010-06-23 10:16 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff
Patch 2: JSC bindings (95.00 KB, patch)
2010-06-23 10:36 PDT, Sterling Swigart
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sterling Swigart 2010-06-18 13:32:34 PDT
This patch exposes the classes and their callbacks to JSC through Image.webkitGetImage. The API is functionally incomplete, so it only will ever call the error callback or throw exceptions.
Comment 1 Sterling Swigart 2010-06-18 13:53:46 PDT
Created attachment 59151 [details]
Patch 2: JSC bindings
Comment 2 Sterling Swigart 2010-06-18 14:05:19 PDT
Created attachment 59155 [details]
Patch 2: JSC bindings
Comment 3 Sterling Swigart 2010-06-18 16:00:22 PDT
Created attachment 59163 [details]
Patch 2: JSC bindings
Comment 4 Sterling Swigart 2010-06-18 16:05:10 PDT
Created attachment 59165 [details]
Patch 2: JSC bindings
Comment 5 Adam Barth 2010-06-18 16:12:34 PDT
Comment on attachment 59165 [details]
Patch 2: JSC bindings

I'm pretty sure you can create these bindings without any extra code.  If you have trouble, you should ask dumi.

WebCore/ChangeLog:59
 +  2010-06-18  Sterling Swigart  <sswigart@google.com>
You have two ChangeLogs in this patch.

WebCore/bindings/js/JSCustomImageResizerErrorCallback.cpp:47
 +  JSCustomImageResizerErrorCallback::JSCustomImageResizerErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
We should be able to auto-generate these callbacks now.  There are some examples in the database bindings.

WebCore/html/HTMLImageElement.idl:56
 +          [Custom] void webkitGetImage(in DOMString mimeType, in ImageResizerSuccessCallback successCallback, [Optional] in ImageResizerErrorCallback errorCallback, [Optional] in ResizeOptions options)
This shouldn't be custom.
Comment 6 Sterling Swigart 2010-06-21 18:19:13 PDT
Created attachment 59321 [details]
Patch 2: JSC bindings
Comment 7 Dumitru Daniliuc 2010-06-21 18:39:52 PDT
Comment on attachment 59321 [details]
Patch 2: JSC bindings

some drive-by comments:

WebCore/bindings/scripts/CodeGeneratorJS.pm:2182
 +                  push(@implContent, "    args.append(");
minor: it might be nicer to keep the code shorter by moving this line and the one after the if-block, inside the if-else block:
if (...)
  push(@implContent, "    args.append(jsString(exec, ${paramName}));\n");
else
  ...

or maybe even add a separate function for this? getToJSString()? i'll let adam decide what's best. :)

WebCore/bindings/scripts/CodeGeneratorJS.pm:2185
 +                   } else {
indentation is off by 1 space.

do we need to change the V8 code generator too? or toV8() works correctly on Strings?
Comment 8 Adam Barth 2010-06-21 18:45:06 PDT
I'm concerned that the spec for this API hasn't received enough review.  For example, it's unclear to to implement resizeOptions in other languages, such as Objective-C.  If we want other browsers to adopt this API, we should make sure it follows the regular conventions of other DOM APIs, such as being language neutral.
Comment 9 Sterling Swigart 2010-06-22 10:00:56 PDT
(In reply to comment #5)
> (From update of attachment 59165 [details])
> I'm pretty sure you can create these bindings without any extra code.  If you have trouble, you should ask dumi.
> 

Done.

> WebCore/ChangeLog:59
>  +  2010-06-18  Sterling Swigart  <sswigart@google.com>
> You have two ChangeLogs in this patch.
> 

Fixed.

> WebCore/bindings/js/JSCustomImageResizerErrorCallback.cpp:47
>  +  JSCustomImageResizerErrorCallback::JSCustomImageResizerErrorCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
> We should be able to auto-generate these callbacks now.  There are some examples in the database bindings.
> 

Done.

> WebCore/html/HTMLImageElement.idl:56
>  +          [Custom] void webkitGetImage(in DOMString mimeType, in ImageResizerSuccessCallback successCallback, [Optional] in ImageResizerErrorCallback errorCallback, [Optional] in ResizeOptions options)
> This shouldn't be custom.

I asked WPL about this, but I am still looking for further feedback on the current state of this patch.


@Dumitru:

- I consolidated the new CodeGeneratorJS.pm code.
- This patch is only for JSC bindings--when the V8 bindings are added, CodeGeneratorV8.pm will be changed to match.
Comment 10 Sterling Swigart 2010-06-22 10:01:19 PDT
Created attachment 59383 [details]
Patch 2: JSC bindings
Comment 11 Sterling Swigart 2010-06-22 10:38:05 PDT
Created attachment 59387 [details]
Patch 2: JSC bindings
Comment 12 Sterling Swigart 2010-06-22 14:12:00 PDT
Created attachment 59415 [details]
Patch 2: JSC bindings
Comment 13 Sterling Swigart 2010-06-22 18:12:58 PDT
Created attachment 59451 [details]
Patch 2: JSC bindings
Comment 14 Sterling Swigart 2010-06-22 19:20:50 PDT
Created attachment 59463 [details]
Patch 2: JSC bindings
Comment 15 Sterling Swigart 2010-06-22 19:34:58 PDT
Created attachment 59465 [details]
Patch 2: JSC bindings
Comment 16 WebKit Review Bot 2010-06-22 19:41:38 PDT
Attachment 59465 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:92:  Tab found; better to use spaces  [whitespace/tab] [1]
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:93:  Tab found; better to use spaces  [whitespace/tab] [1]
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:94:  Tab found; better to use spaces  [whitespace/tab] [1]
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:101:  Tab found; better to use spaces  [whitespace/tab] [1]
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:102:  Tab found; better to use spaces  [whitespace/tab] [1]
WebCore/bindings/js/JSHTMLImageElementCustom.cpp:103:  Tab found; better to use spaces  [whitespace/tab] [1]
Total errors found: 6 in 45 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Sterling Swigart 2010-06-22 19:55:28 PDT
Created attachment 59467 [details]
Patch 2: JSC bindings
Comment 18 WebKit Review Bot 2010-06-22 20:41:06 PDT
Attachment 59467 [details] did not build on chromium:
Build output: http://webkit-commit-queue.appspot.com/results/3281627
Comment 19 Sterling Swigart 2010-06-22 21:43:39 PDT
Created attachment 59474 [details]
Patch 2: JSC bindings
Comment 20 Sterling Swigart 2010-06-22 21:57:18 PDT
Created attachment 59476 [details]
Patch 2: JSC bindings
Comment 21 Sterling Swigart 2010-06-22 22:27:08 PDT
Created attachment 59478 [details]
Patch 2: JSC bindings
Comment 22 WebKit Review Bot 2010-06-22 23:16:31 PDT
Attachment 59478 [details] did not build on chromium:
Build output: http://webkit-commit-queue.appspot.com/results/3337572
Comment 23 Sterling Swigart 2010-06-23 10:16:52 PDT
Created attachment 59527 [details]
Patch 2: JSC bindings
Comment 24 Early Warning System Bot 2010-06-23 10:28:41 PDT
Attachment 59527 [details] did not build on qt:
Build output: http://webkit-commit-queue.appspot.com/results/3309603
Comment 25 Sterling Swigart 2010-06-23 10:36:24 PDT
Created attachment 59530 [details]
Patch 2: JSC bindings
Comment 26 WebKit Review Bot 2010-06-23 10:53:46 PDT
Attachment 59527 [details] did not build on chromium:
Build output: http://webkit-commit-queue.appspot.com/results/3291659
Comment 27 WebKit Review Bot 2010-06-23 12:14:48 PDT
Attachment 59530 [details] did not build on chromium:
Build output: http://webkit-commit-queue.appspot.com/results/3273615
Comment 28 Dumitru Daniliuc 2010-06-23 17:57:19 PDT
Just wanted to point out that the cr-linux bot (incorrectly) skips at least one step when building WebKit, so it goes red for any patch with IDL changes. If you're concerned about that bot, I'd recommend just patching the changes into a clean Chromium client and building it locally.
Comment 29 Adam Barth 2010-06-23 18:42:01 PDT
(In reply to comment #28)
> Just wanted to point out that the cr-linux bot (incorrectly) skips at least one step when building WebKit, so it goes red for any patch with IDL changes. If you're concerned about that bot, I'd recommend just patching the changes into a clean Chromium client and building it locally.

What step is the bot supposed to run?  It just calls "build-webkit --chromium"
Comment 30 Sterling Swigart 2010-06-23 18:45:54 PDT
(In reply to comment #29)
> (In reply to comment #28)
> > Just wanted to point out that the cr-linux bot (incorrectly) skips at least one step when building WebKit, so it goes red for any patch with IDL changes. If you're concerned about that bot, I'd recommend just patching the changes into a clean Chromium client and building it locally.
> 
> What step is the bot supposed to run?  It just calls "build-webkit --chromium"

In my case, I was developing this API under the ENABLE_IMAGE_RESIZER flag, but someone flipped it from 0 to 1 without me knowing. It shouldn't be building the stuff in the IDLs at all--which is being fixed with 41116.
Comment 31 Dumitru Daniliuc 2010-06-24 16:41:49 PDT
> What step is the bot supposed to run?  It just calls "build-webkit --chromium"

It looks like it misses the "gclient sync" step (WebKitTools/Scripts/update-webkit-chromium). So whenever new files are added, the Makefile is not regenerated, which leads to build errors.