[webkit-reviews] review requested: [Bug 38414] Auto-generate the callbacks code : [Attachment 54842] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 30 18:01:37 PDT 2010


Dumitru Daniliuc <dumi at chromium.org> has asked	for review:
Bug 38414: Auto-generate the callbacks code
https://bugs.webkit.org/show_bug.cgi?id=38414

Attachment 54842: patch
https://bugs.webkit.org/attachment.cgi?id=54842&action=review

------- Additional Comments from Dumitru Daniliuc <dumi at chromium.org>
Attaching only the CodeGeneratorJS.pm changes for now (will port to
CodeGeneratorV8.pm once we have a final CodeGeneratorJS.pm version).

The patch adds support for callbacks that do not return a value.

The developers will be expected to provide the MyCallback.h and MyCallback.idl
files as follows:

MyCallback.h:
namespace WebCore {

class MyClass1;
class MyClass2;
class ScriptExecutionContext;

class MyCallback {
public:
    virtual ~MyCallback();
    virtual bool doStuffWithClass1(ScriptExecutionContext* context, MyClass1*
obj1) = 0;
    virtual bool doStuffWithClass2(ScriptExecutionContext* context, MyClass2*
obj2, ... other input parameters ... ) = 0;
};

} // namespace WebCore


MyCallbacks.idl
module SomeModule {
    interface [
	Callback
    ] MyCallbacks {
	boolean doStuffWithClass1(in ScriptExecutionContext context, in
MyClass1 obj1);
	boolean doStuffWithClass2(in ScriptExecutionContext context, in
MyClass2 obj2, ... other input parameters ... );
    }
}

Then the code generators will auto-generate a MyCallback implementation that
will invoke the callback with the given parameters.

Restrictions:
-- First parameter must be a ScriptExecutionContext.
-- The return type must be bool (but can be ignored). It tells the developer if
an exception was thrown while invoking the callback.


More information about the webkit-reviews mailing list