Add support for Web IDL callback interfaces to the bindings generator
authorch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 15:55:12 +0000 (15:55 +0000)
committerch.dumez@sisa.samsung.com <ch.dumez@sisa.samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Apr 2013 15:55:12 +0000 (15:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115179

Reviewed by Kentaro Hara.

Add support in the bindings generator for Web IDL callback interfaces:
http://dev.w3.org/2006/webapi/WebIDL/#dfn-callback-interface

Drop support for the WebKit-specific [Callback] extended attributes
on Web IDL interfaces and update existing IDL files to use proper
callback interfaces instead.

No new tests, no behavior change.

* Modules/filesystem/EntriesCallback.idl:
* Modules/filesystem/EntryCallback.idl:
* Modules/filesystem/ErrorCallback.idl:
* Modules/filesystem/FileCallback.idl:
* Modules/filesystem/FileSystemCallback.idl:
* Modules/filesystem/FileWriterCallback.idl:
* Modules/filesystem/MetadataCallback.idl:
* Modules/geolocation/PositionCallback.idl:
* Modules/geolocation/PositionErrorCallback.idl:
* Modules/mediastream/NavigatorUserMediaErrorCallback.idl:
* Modules/mediastream/NavigatorUserMediaSuccessCallback.idl:
* Modules/mediastream/RTCErrorCallback.idl:
* Modules/mediastream/RTCSessionDescriptionCallback.idl:
* Modules/mediastream/RTCStatsCallback.idl:
* Modules/notifications/NotificationPermissionCallback.idl:
* Modules/quota/StorageErrorCallback.idl:
* Modules/quota/StorageQuotaCallback.idl:
* Modules/quota/StorageUsageCallback.idl:
* Modules/webaudio/AudioBufferCallback.idl:
* Modules/webdatabase/DatabaseCallback.idl:
* Modules/webdatabase/SQLStatementCallback.idl:
* Modules/webdatabase/SQLStatementErrorCallback.idl:
* Modules/webdatabase/SQLTransactionCallback.idl:
* Modules/webdatabase/SQLTransactionErrorCallback.idl:
* Modules/webdatabase/SQLTransactionSyncCallback.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateInterface):
* bindings/scripts/IDLParser.pm:
(parseCallbackRestOrInterface):
* bindings/scripts/test/TestCallback.idl:
* dom/RequestAnimationFrameCallback.idl:
* dom/StringCallback.idl:
* html/VoidCallback.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149113 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/filesystem/EntriesCallback.idl
Source/WebCore/Modules/filesystem/EntryCallback.idl
Source/WebCore/Modules/filesystem/ErrorCallback.idl
Source/WebCore/Modules/filesystem/FileCallback.idl
Source/WebCore/Modules/filesystem/FileSystemCallback.idl
Source/WebCore/Modules/filesystem/FileWriterCallback.idl
Source/WebCore/Modules/filesystem/MetadataCallback.idl
Source/WebCore/Modules/geolocation/PositionCallback.idl
Source/WebCore/Modules/geolocation/PositionErrorCallback.idl
Source/WebCore/Modules/mediastream/NavigatorUserMediaErrorCallback.idl
Source/WebCore/Modules/mediastream/NavigatorUserMediaSuccessCallback.idl
Source/WebCore/Modules/mediastream/RTCErrorCallback.idl
Source/WebCore/Modules/mediastream/RTCSessionDescriptionCallback.idl
Source/WebCore/Modules/mediastream/RTCStatsCallback.idl
Source/WebCore/Modules/notifications/NotificationPermissionCallback.idl
Source/WebCore/Modules/quota/StorageErrorCallback.idl
Source/WebCore/Modules/quota/StorageQuotaCallback.idl
Source/WebCore/Modules/quota/StorageUsageCallback.idl
Source/WebCore/Modules/webaudio/AudioBufferCallback.idl
Source/WebCore/Modules/webdatabase/DatabaseCallback.idl
Source/WebCore/Modules/webdatabase/SQLStatementCallback.idl
Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.idl
Source/WebCore/Modules/webdatabase/SQLTransactionCallback.idl
Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.idl
Source/WebCore/Modules/webdatabase/SQLTransactionSyncCallback.idl
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLParser.pm
Source/WebCore/bindings/scripts/test/TestCallback.idl
Source/WebCore/dom/RequestAnimationFrameCallback.idl
Source/WebCore/dom/StringCallback.idl
Source/WebCore/html/VoidCallback.idl

index 0d82429..3e5f221 100644 (file)
@@ -1,3 +1,53 @@
+2013-04-25  Christophe Dumez  <ch.dumez@sisa.samsung.com>
+
+        Add support for Web IDL callback interfaces to the bindings generator
+        https://bugs.webkit.org/show_bug.cgi?id=115179
+
+        Reviewed by Kentaro Hara.
+
+        Add support in the bindings generator for Web IDL callback interfaces:
+        http://dev.w3.org/2006/webapi/WebIDL/#dfn-callback-interface
+
+        Drop support for the WebKit-specific [Callback] extended attributes
+        on Web IDL interfaces and update existing IDL files to use proper
+        callback interfaces instead.
+
+        No new tests, no behavior change.
+
+        * Modules/filesystem/EntriesCallback.idl:
+        * Modules/filesystem/EntryCallback.idl:
+        * Modules/filesystem/ErrorCallback.idl:
+        * Modules/filesystem/FileCallback.idl:
+        * Modules/filesystem/FileSystemCallback.idl:
+        * Modules/filesystem/FileWriterCallback.idl:
+        * Modules/filesystem/MetadataCallback.idl:
+        * Modules/geolocation/PositionCallback.idl:
+        * Modules/geolocation/PositionErrorCallback.idl:
+        * Modules/mediastream/NavigatorUserMediaErrorCallback.idl:
+        * Modules/mediastream/NavigatorUserMediaSuccessCallback.idl:
+        * Modules/mediastream/RTCErrorCallback.idl:
+        * Modules/mediastream/RTCSessionDescriptionCallback.idl:
+        * Modules/mediastream/RTCStatsCallback.idl:
+        * Modules/notifications/NotificationPermissionCallback.idl:
+        * Modules/quota/StorageErrorCallback.idl:
+        * Modules/quota/StorageQuotaCallback.idl:
+        * Modules/quota/StorageUsageCallback.idl:
+        * Modules/webaudio/AudioBufferCallback.idl:
+        * Modules/webdatabase/DatabaseCallback.idl:
+        * Modules/webdatabase/SQLStatementCallback.idl:
+        * Modules/webdatabase/SQLStatementErrorCallback.idl:
+        * Modules/webdatabase/SQLTransactionCallback.idl:
+        * Modules/webdatabase/SQLTransactionErrorCallback.idl:
+        * Modules/webdatabase/SQLTransactionSyncCallback.idl:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateInterface):
+        * bindings/scripts/IDLParser.pm:
+        (parseCallbackRestOrInterface):
+        * bindings/scripts/test/TestCallback.idl:
+        * dom/RequestAnimationFrameCallback.idl:
+        * dom/StringCallback.idl:
+        * html/VoidCallback.idl:
+
 2013-04-25  Adrian Perez de Castro  <aperez@igalia.com>
 
         [GStreamer] Add audio/speex MIME type as supported
index 26f1a21..aa0d555 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface EntriesCallback {
+] callback interface EntriesCallback {
     boolean handleEvent(in EntryArray entries);
 };
index b4db4db..9c0d80d 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface EntryCallback {
+] callback interface EntryCallback {
     boolean handleEvent(in Entry entry);
 };
index f840a50..2182e34 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface ErrorCallback {
+] callback interface ErrorCallback {
     boolean handleEvent(in FileError error);
 };
index 00beba8..8365e94 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface FileCallback {
+] callback interface FileCallback {
     boolean handleEvent(in File file);
 };
index c8006b2..71cbefe 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface FileSystemCallback {
+] callback interface FileSystemCallback {
     boolean handleEvent(in DOMFileSystem fileSystem);
 };
index 9c920a4..85694b9 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface FileWriterCallback {
+] callback interface FileWriterCallback {
     boolean handleEvent(in FileWriter fileWriter);
 };
index 86c5cc6..3e18d5d 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=FILE_SYSTEM,
-    Callback
-] interface MetadataCallback {
+] callback interface MetadataCallback {
     boolean handleEvent(in Metadata metadata);
 };
index de2eeb3..1bf0a10 100644 (file)
@@ -24,7 +24,6 @@
 
 [
     Conditional=GEOLOCATION,
-    Callback
-] interface PositionCallback {
+] callback interface PositionCallback {
     boolean handleEvent(in Geoposition position);
 };
index 8d78488..6212d2b 100644 (file)
@@ -24,7 +24,6 @@
 
 [
     Conditional=GEOLOCATION,
-    Callback
-] interface PositionErrorCallback {
+] callback interface PositionErrorCallback {
     boolean handleEvent(in PositionError error);
 };
index 3ab837b..728d170 100644 (file)
@@ -24,8 +24,7 @@
 
 [
     Conditional=MEDIA_STREAM,
-    Callback
-] interface NavigatorUserMediaErrorCallback {
+] callback interface NavigatorUserMediaErrorCallback {
     boolean handleEvent(in NavigatorUserMediaError error);
 };
 
index 4da4cd5..453b871 100644 (file)
@@ -24,8 +24,7 @@
 
 [
     Conditional=MEDIA_STREAM,
-    Callback
-] interface NavigatorUserMediaSuccessCallback {
+] callback interface NavigatorUserMediaSuccessCallback {
     boolean handleEvent(in LocalMediaStream stream);
 };
 
index b97b702..e120ed0 100644 (file)
@@ -30,8 +30,7 @@
 
 [
     Conditional=MEDIA_STREAM,
-    Callback
-] interface RTCErrorCallback {
+] callback interface RTCErrorCallback {
     boolean handleEvent(in DOMString errorInformation);
 };
 
index fec6754..75592f8 100644 (file)
@@ -30,8 +30,7 @@
 
 [
     Conditional=MEDIA_STREAM,
-    Callback
-] interface RTCSessionDescriptionCallback {
+] callback interface RTCSessionDescriptionCallback {
     boolean handleEvent(in RTCSessionDescription sdp);
 };
 
index 15a0d4f..a5d4e51 100644 (file)
@@ -24,8 +24,7 @@
 
 [
     Conditional=MEDIA_STREAM,
-    Callback
-] interface RTCStatsCallback {
+] callback interface RTCStatsCallback {
     boolean handleEvent(in RTCStatsResponse response);
 };
 
index bb77716..e2287bc 100644 (file)
@@ -25,8 +25,7 @@
 
 [
     Conditional=NOTIFICATIONS,
-    Callback
-] interface NotificationPermissionCallback {
+] callback interface NotificationPermissionCallback {
     boolean handleEvent(in DOMString permission);
 };
 
index decdd99..992c167 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=QUOTA,
-    Callback
-] interface StorageErrorCallback {
+] callback interface StorageErrorCallback {
     boolean handleEvent(in DOMCoreException error);
 };
index 502c106..cf4a3de 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=QUOTA,
-    Callback
-] interface StorageQuotaCallback {
+] callback interface StorageQuotaCallback {
     boolean handleEvent(in unsigned long long grantedQuotaInBytes);
 };
index f419264..43b36be 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=QUOTA,
-    Callback
-] interface StorageUsageCallback {
+] callback interface StorageUsageCallback {
     boolean handleEvent(in unsigned long long currentUsageInBytes, in unsigned long long currentQuotaInBytes);
 };
index 365c8ea..5ef4d02 100644 (file)
@@ -25,7 +25,6 @@
 [
     Conditional=WEB_AUDIO,
     JSGenerateToJSObject,
-    Callback
-] interface AudioBufferCallback {
+] callback interface AudioBufferCallback {
     boolean handleEvent(in AudioBuffer audioBuffer);
 };
index 1933ff9..bd44746 100644 (file)
@@ -28,8 +28,7 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface DatabaseCallback {
+] callback interface DatabaseCallback {
     boolean handleEvent(in Database database);
     boolean handleEvent(in DatabaseSync database);
 };
index 5ce2dd7..a77fd34 100644 (file)
@@ -28,7 +28,6 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface SQLStatementCallback {
+] callback interface SQLStatementCallback {
     boolean handleEvent(in SQLTransaction transaction, in SQLResultSet resultSet);
 };
index ddea789..1e2979d 100644 (file)
@@ -28,7 +28,6 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface SQLStatementErrorCallback {
+] callback interface SQLStatementErrorCallback {
     [Custom] boolean handleEvent(in SQLTransaction transaction, in SQLError error);
 };
index d09ae9d..ff80f3d 100644 (file)
@@ -28,7 +28,6 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface SQLTransactionCallback {
+] callback interface SQLTransactionCallback {
     boolean handleEvent(in SQLTransaction transaction);
 };
index e8f8dda..ed03e82 100644 (file)
@@ -28,7 +28,6 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface SQLTransactionErrorCallback {
+] callback interface SQLTransactionErrorCallback {
     boolean handleEvent(in SQLError error);
 };
index 308c911..068b94b 100644 (file)
@@ -30,7 +30,6 @@
 
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface SQLTransactionSyncCallback {
+] callback interface SQLTransactionSyncCallback {
     boolean handleEvent(in SQLTransactionSync transaction);
 };
index 68bd907..0eb4f0c 100644 (file)
@@ -95,7 +95,7 @@ sub GenerateInterface
     $codeGenerator->LinkOverloadedFunctions($interface);
 
     # Start actual generation
-    if ($interface->extendedAttributes->{"Callback"}) {
+    if ($interface->isCallback) {
         $object->GenerateCallbackHeader($interface);
         $object->GenerateCallbackImplementation($interface);
     } else {
index f000355..70f05ba 100644 (file)
@@ -50,6 +50,7 @@ struct( domInterface => {
     extendedAttributes => '$', # Extended attributes
     constructors => '@', # Constructors, list of 'domFunction'
     isException => '$', # Used for exception interfaces
+    isCallback => '$', # Used for callback interfaces
 });
 
 # Used to represent domInterface contents (name of method, signature)
@@ -474,7 +475,9 @@ sub parseCallbackRestOrInterface
 
     my $next = $self->nextToken();
     if ($next->value() eq "interface") {
-        return $self->parseInterface($extendedAttributeList);
+        my $interface = $self->parseInterface($extendedAttributeList);
+        $interface->isCallback(1);
+        return $interface;
     }
     if ($next->type() == IdentifierToken) {
         return $self->parseCallbackRest($extendedAttributeList);
index ed19447..6b24856 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-// This IDL file is for testing the bindings code generator with an interface
-// that has the "Callback" attribute and for tracking changes in its ouput.
+// This IDL file is for testing the bindings code generator with a callback
+// interface and for tracking changes in its ouput.
 [
     Conditional=SQL_DATABASE,
-    Callback
-] interface TestCallback {
+] callback interface TestCallback {
   boolean callbackWithNoParam();
   boolean callbackWithClass1Param(in Class1 class1Param);
   boolean callbackWithClass2Param(in Class2 class2Param, in DOMString strArg);
index f251f3d..d4e81fb 100644 (file)
@@ -29,9 +29,8 @@
  */
 
 [
-    Callback,
     Conditional=REQUEST_ANIMATION_FRAME,
-] interface RequestAnimationFrameCallback{
+] callback interface RequestAnimationFrameCallback{
     // highResTime is passed as high resolution timestamp, see
     // http://www.w3.org/TR/hr-time/ for details.
     [Custom] boolean handleEvent(in double highResTime);
index a26831b..cd99b12 100644 (file)
@@ -28,8 +28,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-[
-    Callback
-] interface StringCallback {
+callback interface StringCallback {
     boolean handleEvent(in DOMString data);
 };
index 31a2215..577fcf5 100644 (file)
@@ -23,8 +23,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-[
-    Callback
-] interface VoidCallback {
+callback interface VoidCallback {
     boolean handleEvent();
 };