12011-12-07 Kentaro Hara <haraken@chromium.org>
2
3 Use the [Supplemental] IDL for webaudio attributes in Chromium
4 https://bugs.webkit.org/show_bug.cgi?id=73394
5
6 Reviewed by Adam Barth.
7
8 - Overview: Using the [Supplemental] IDL, this patch moves the attribute
9 declarations of webaudio from DOMWindow.idl into a new IDL file
10 webaudio/DOMWindowWebAudio.idl, which helps make webaudio a self-contained
11 feature (aka a module).
12
13 - This patch changes the build flow of WebCore.gyp as follows:
14
15 Previous build flow:
16 foreach $idl (all IDL files) {
17 generate-bindings.pl depends on $idl;
18 generate-bindings.pl reads $idl;
19 generate-bindings.pl generates .h and .cpp files for $idl;
20 }
21
22 New build flow (See the discussions in bug 72138 for more details):
23 resolve-supplemental.pl depends on all IDL files;
24 resolve-supplemental.pl reads all IDL files;
25 resolve-supplemental.pl resolves the dependency of [Supplemental=XXXX];
26 resolve-supplemental.pl outputs supplemental_dependency.tmp;
27 foreach $idl (all IDL files) {
28 generate-bindings.pl depends on $idl and supplemental_dependency.tmp;
29 generate-bindings.pl reads $idl;
30 generate-bindings.pl reads supplemental_dependency.tmp;
31 generate-bindings.pl generates .h and .cpp files for $idl, including all attributes in IDL files whilementing $idl;
32 }
33
34 - This patch introduces a temporary IDL, [Supplemented]. The [Supplemented] IDL
35 will be removed after build scripts for all platforms support the [Supplemental] IDL.
36 The motivation for the [Supplemented] IDL is as follows:
37
38 In order to support the [Supplemental] IDL, we need to
39 (1) run resolve-supplemental.pl and generate supplemental_dependency.tmp
40 (2) and run generate-bindings.pl with the supplemental_dependency.tmp.
41
42 This build flow requires a change on the following build scripts,
43 but changing all the build scripts all at once without any regression is too difficult:
44
45 - DerivedSources.make
46 - DerivedSources.pri
47 - GNUmakefile.am
48 - PlatformBlackBerry.cmake
49 - UseJSC.cmake
50 - UseV8.cmake
51 - WebCore.vcproj/MigrateScripts
52 - WebCore.vcproj/WebCore.vcproj
53 - bindings/gobject/GNUmakefile.am
54 - WebCore.gyp/WebCore.gyp
55
56 Thus, we are planning to change the build scripts one by one, which implies that
57 we need to allow the temporary state in which some build scripts support [Supplemental] IDL
58 but others do not. To accomplish this, we introduce a temporary IDL, [Supplemented].
59 The [Supplemented] IDL on an attribute means that the attribute is marked with [Supplemental]
60 in another IDL file somewhere, like this:
61
62 DOMWindowWebAudio.idl:
63 interface [
64 Supplemental=DOMWindow
65 ] DOMWindowWebAudio {
66 attribute attr1;
67 attribute attr2;
68 };
69
70 DOMWindow.idl:
71 interface [
72 ] DOMWindow {
73 attribute [Supplemented] attr1; // This line will be removed after all build scripts support the [Su IDL
74 attribute [Supplemented] attr2; // This line will be removed after all build scripts support the [Su IDL.
75 attribute attr3;
76 attribute attr4;
77 };
78
79 Assuming these IDL files, this patch implements the following logic in generate-bindings.pl:
80
81 - If a given build script supports the [Supplemental] IDL,
82 generate-bindings.pl ignores all attributes with the [Supplemented] IDL.
83 - Otherwise, generate-bindings.pl treats all attributes with the [Supplemented] IDL
84 as normal attributes and instead ignores all attributes with the [Supplemental] IDL
85 (i.e. generate-bindings.pl generates nothing from the IDL file with the [Supplemental] IDL).
86
87 Tests: webaudio/*
88
89 * WebCore.gyp/WebCore.gyp: Describes the build flow that I described above.
90 * WebCore.gyp/scripts/action_derivedsourcesallinone.py:
91 (main): Reads the IDL file names from the input file (i.e. supplemental_dependency.tmp), which are described at the first column of each line in the input file. If the file name is a "/cygdrive/c/..."-style path, it is converted to a "C:\cygwin\..."-style path by the cygpath command.
92 * WebCore.gypi: Added DOMWindowWebAudio.idl.
93 * bindings/scripts/generate-bindings.pl: As a temporary solution, if the platform does not support the [Supplemental] IDL, the perl script ignores the [Supplemental] IDL and instead uses the [Supplemented] IDL. Otherwise, the perl script ignores the [Supplemented] IDL and instead uses the [Supplemental] IDL.
94 * page/DOMWindow.idl: Added the [Supplemented] IDL to webaudio-related attributes. As I described above, the [Supplemented] IDL will be removed after all platforms support the [Supplemental] IDL.
95 * webaudio/DOMWindowWebAudio.idl: Added. Describes the [Supplemental=DOMWindow] IDL. The attributes in this IDL file should be treated as if they are written in DOMWindow.idl.
96