| Differences between
and this patch
- a/Source/WebCore/ChangeLog +96 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-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 NOBODY (OOPS!).
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
1
2011-12-07  Joshua Bell  <jsbell@chromium.org>
97
2011-12-07  Joshua Bell  <jsbell@chromium.org>
2
98
3
        IndexedDB: Replace bool args in IDBKeyRange private methods with enum
99
        IndexedDB: Replace bool args in IDBKeyRange private methods with enum
- a/Source/WebCore/WebCore.gyp/WebCore.gyp -8 / +44 lines
Lines 446-454 a/Source/WebCore/WebCore.gyp/WebCore.gyp_sec1
446
      ]
446
      ]
447
    },
447
    },
448
    {
448
    {
449
      'target_name': 'generate_supplemental_dependency',
450
      'type': 'none',
451
      'actions': [
452
         {
453
          'action_name': 'generateSupplementalDependency',
454
          'variables': {
455
            # Write sources into a file, so that the action command line won't
456
            # exceed OS limits.
457
            'idl_files_list': '<|(idl_files_list.tmp <@(bindings_idl_files))',
458
          },
459
          'inputs': [
460
            '../bindings/scripts/resolve-supplemental.pl',
461
            '../bindings/scripts/IDLParser.pm',
462
            '<(idl_files_list)',
463
            '<!@(cat <(idl_files_list))',
464
          ],
465
          'outputs': [
466
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
467
          ],
468
          'action': [
469
            'perl',
470
            '-w',
471
            '-I../bindings/scripts',
472
            '../bindings/scripts/resolve-supplemental.pl',
473
            '--defines',
474
            '<(feature_defines) LANGUAGE_JAVASCRIPT V8_BINDING',
475
            '--idlFilesList',
476
            '<(idl_files_list)',
477
            '--supplementalDependencyFile',
478
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
479
          ],
480
          'message': 'Resolving [Supplemental=XXX] dependencies in all IDL files',
481
        }
482
      ]
483
    },
484
    {
449
      'target_name': 'webcore_bindings_sources',
485
      'target_name': 'webcore_bindings_sources',
450
      'type': 'none',
486
      'type': 'none',
451
      'hard_dependency': 1,
487
      'hard_dependency': 1,
488
      'dependencies': [
489
        'generate_supplemental_dependency',
490
      ],
452
      'sources': [
491
      'sources': [
453
        # bison rule
492
        # bison rule
454
        '../css/CSSGrammar.y',
493
        '../css/CSSGrammar.y',
Lines 861-875 a/Source/WebCore/WebCore.gyp/WebCore.gyp_sec2
861
        },
900
        },
862
        {
901
        {
863
          'action_name': 'derived_sources_all_in_one',
902
          'action_name': 'derived_sources_all_in_one',
864
          'variables': {
865
            # Write sources into a file, so that the action command line won't
866
            # exceed OS limites.
867
            'idls_list_temp_file': '<|(idls_list_temp_file.tmp <@(bindings_idl_files))',
868
          },
869
          'inputs': [
903
          'inputs': [
870
            'scripts/action_derivedsourcesallinone.py',
904
            'scripts/action_derivedsourcesallinone.py',
871
            '<(idls_list_temp_file)',
905
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
872
            '<!@(cat <(idls_list_temp_file))',
873
          ],
906
          ],
874
          'outputs': [
907
          'outputs': [
875
            '<@(derived_sources_aggregate_files)',
908
            '<@(derived_sources_aggregate_files)',
Lines 877-883 a/Source/WebCore/WebCore.gyp/WebCore.gyp_sec3
877
          'action': [
910
          'action': [
878
            'python',
911
            'python',
879
            'scripts/action_derivedsourcesallinone.py',
912
            'scripts/action_derivedsourcesallinone.py',
880
            '<(idls_list_temp_file)',
913
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
881
            '--',
914
            '--',
882
            '<@(derived_sources_aggregate_files)',
915
            '<@(derived_sources_aggregate_files)',
883
          ],
916
          ],
Lines 930-935 a/Source/WebCore/WebCore.gyp/WebCore.gyp_sec4
930
            '../bindings/scripts/IDLParser.pm',
963
            '../bindings/scripts/IDLParser.pm',
931
            '../bindings/scripts/IDLStructure.pm',
964
            '../bindings/scripts/IDLStructure.pm',
932
            '../bindings/scripts/preprocessor.pm',
965
            '../bindings/scripts/preprocessor.pm',
966
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
933
          ],
967
          ],
934
          'outputs': [
968
          'outputs': [
935
            # FIXME:  The .cpp file should be in webkit/bindings once
969
            # FIXME:  The .cpp file should be in webkit/bindings once
Lines 975-980 a/Source/WebCore/WebCore.gyp/WebCore.gyp_sec5
975
            '--generator',
1009
            '--generator',
976
            'V8',
1010
            'V8',
977
            '<@(generator_include_dirs)',
1011
            '<@(generator_include_dirs)',
1012
            '--supplementalDependencyFile',
1013
            '<(SHARED_INTERMEDIATE_DIR)/supplemental_dependency.tmp',
978
            '<(RULE_INPUT_PATH)',
1014
            '<(RULE_INPUT_PATH)',
979
          ],
1015
          ],
980
          'message': 'Generating binding from <(RULE_INPUT_PATH)',
1016
          'message': 'Generating binding from <(RULE_INPUT_PATH)',
- a/Source/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py -3 / +11 lines
Lines 32-43 a/Source/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py_sec1
32
# Use of this source code is governed by a BSD-style license that can be
32
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
33
# found in the LICENSE file.
34
34
35
# action_derivedsourceslist.py generates a single cpp file that includes
35
# action_derivedsourcesallinone.py generates a single cpp file that includes
36
# all v8 bindings cpp files generated from idls. Files can be assigned into
36
# all v8 bindings cpp files generated from idls. Files can be assigned into
37
# multiple output files, to reduce maximum compilation unit size and allow
37
# multiple output files, to reduce maximum compilation unit size and allow
38
# parallel compilation.
38
# parallel compilation.
39
#
39
#
40
# usage: action_derivedsourceslist.py IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ...
40
# usage: action_derivedsourcesallinone.py IDL_FILES_LIST -- OUTPUT_FILE1 OUTPUT_FILE2 ...
41
#
41
#
42
# Note that IDL_FILES_LIST is a text file containing the IDL file paths.
42
# Note that IDL_FILES_LIST is a text file containing the IDL file paths.
43
43
Lines 48-53 import re a/Source/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py_sec2
48
import subprocess
48
import subprocess
49
import sys
49
import sys
50
50
51
sys.path.append("../../../Tools/Scripts/")
52
from webkitpy.common.system import path
53
51
# A regexp for finding Conditional attributes in interface definitions.
54
# A regexp for finding Conditional attributes in interface definitions.
52
conditionalPattern = re.compile('interface[\s]*\[[^\]]*Conditional=([\_0-9a-zA-Z&|]*)')
55
conditionalPattern = re.compile('interface[\s]*\[[^\]]*Conditional=([\_0-9a-zA-Z&|]*)')
53
56
Lines 186-192 def main(args): a/Source/WebCore/WebCore.gyp/scripts/action_derivedsourcesallinone.py_sec3
186
    outputFileNames = args[inOutBreakIndex+1:]
189
    outputFileNames = args[inOutBreakIndex+1:]
187
190
188
    inputFile = open(inputFileName, 'r')
191
    inputFile = open(inputFileName, 'r')
189
    idlFileNames = inputFile.read().split('\n')
192
    idlFileNames = []
193
    for line in inputFile:
194
        idlFileName = line[:-1].split(' ')[0]
195
        if idlFileName.find("/cygdrive") == 0:
196
            idlFileName = path.cygpath(idlFileName)
197
        idlFileNames.append(idlFileName)
190
    inputFile.close()
198
    inputFile.close()
191
199
192
    filesMetaData = extractMetaData(idlFileNames)
200
    filesMetaData = extractMetaData(idlFileNames)
- a/Source/WebCore/WebCore.gypi +1 lines
Lines 1492-1497 a/Source/WebCore/WebCore.gypi_sec1
1492
            'webaudio/BiquadFilterNode.idl',
1492
            'webaudio/BiquadFilterNode.idl',
1493
            'webaudio/ConvolverNode.idl',
1493
            'webaudio/ConvolverNode.idl',
1494
            'webaudio/DelayNode.idl',
1494
            'webaudio/DelayNode.idl',
1495
            'webaudio/DOMWindowWebAudio.idl',
1495
            'webaudio/DynamicsCompressorNode.idl',
1496
            'webaudio/DynamicsCompressorNode.idl',
1496
            'webaudio/HighPass2FilterNode.idl',
1497
            'webaudio/HighPass2FilterNode.idl',
1497
            'webaudio/JavaScriptAudioNode.idl',
1498
            'webaudio/JavaScriptAudioNode.idl',
- a/Source/WebCore/bindings/scripts/generate-bindings.pl +73 lines
Lines 112-117 if ($supplementalDependencyFile) { a/Source/WebCore/bindings/scripts/generate-bindings.pl_sec1
112
my $targetParser = IDLParser->new(!$verbose);
112
my $targetParser = IDLParser->new(!$verbose);
113
my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor);
113
my $targetDocument = $targetParser->Parse($targetIdlFile, $defines, $preprocessor);
114
114
115
# FIXME(haraken): Remove this if-else statement.
116
# This if-else statement is temporary and will be removed
117
# after build scripts for all platforms support [Supplemental] IDL.
118
# The motivation for the [Supplemented] IDL is as follows:
119
#
120
# In order to support the [Supplemental] IDL, we need to
121
# (1) run resolve-supplemental.pl and generate supplemental_dependency.tmp
122
# (2) and run generate-bindings.pl with the supplemental_dependency.tmp.
123
#
124
# This build flow requires a change on the following build scripts,
125
# but changing all the build scripts all at once without any regression is too difficult:
126
#
127
#     - DerivedSources.make
128
#     - DerivedSources.pri
129
#     - GNUmakefile.am
130
#     - PlatformBlackBerry.cmake
131
#     - UseJSC.cmake
132
#     - UseV8.cmake
133
#     - WebCore.vcproj/MigrateScripts
134
#     - WebCore.vcproj/WebCore.vcproj
135
#     - bindings/gobject/GNUmakefile.am
136
#     - WebCore.gyp/WebCore.gyp
137
#
138
# Thus, we are planning to change the build scripts one by one, which implies that
139
# we need to allow the temporary state in which some build scripts support [Supplemental] IDL
140
# but others do not. To accomplish this, we introduce a temporal IDL, [Supplemented].
141
# The [Supplemented] IDL on an attribute means that the attribute is marked with [Supplemental]
142
# in another IDL file somewhere, like this:
143
#
144
# DOMWindowWebAudio.idl:
145
#     interface [
146
#         Supplemental=DOMWindow
147
#     ] DOMWindowWebAudio {
148
#         attribute attr1;
149
#         attribute attr2;
150
#     };
151
#
152
# DOMWindow.idl:
153
#     interface [
154
#     ] DOMWindow {
155
#         attribute [Supplemented] attr1; // This line will be removed after all build scripts support the [SupplementalL.
156
#         attribute [Supplemented] attr2; // This line will be removed after all build scripts support the [SupplementalL.
157
#         attribute attr3;
158
#         attribute attr4;
159
#     };
160
#
161
# Assuming these IDL files, the below code is doing the following logic:
162
#
163
#     - If a given build script supports the [Supplemental] IDL (i.e. --supplementalDependencyFile is specified),
164
#       we ignore all attributes with the [Supplemented] IDL.
165
#     - Otherwise (i.e. --supplementalDependencyFile is not specified),
166
#       we treat all attributes with the [Supplemented] IDL as normal attributes
167
#       and instead ignore all attributes with the [Supplemental] IDL
168
#       (i.e. we generate nothing from the idl file with the [Supplemental] IDL).
169
if ($supplementalDependencyFile) {
170
    foreach my $dataNode (@{$targetDocument->classes}) {
171
        my @nonSupplementedAttributes;
172
        foreach my $attribute (@{$dataNode->attributes}) {
173
            if (!$attribute->signature->extendedAttributes->{"Supplemented"}) {
174
                push(@nonSupplementedAttributes, $attribute);
175
            }
176
        }
177
        $dataNode->attributes(\@nonSupplementedAttributes);
178
    }
179
} else {
180
    foreach my $dataNode (@{$targetDocument->classes}) {
181
        if ($dataNode->extendedAttributes->{"Supplemental"}) {
182
            exit 0;
183
        }
184
    }
185
}
186
# Temporary if-else statement until here.
187
115
foreach my $idlFile (@supplementedIdlFiles) {
188
foreach my $idlFile (@supplementedIdlFiles) {
116
    next if $idlFile eq $targetIdlFile;
189
    next if $idlFile eq $targetIdlFile;
117
190
- a/Source/WebCore/page/DOMWindow.idl -4 / +4 lines
Lines 522-529 module window { a/Source/WebCore/page/DOMWindow.idl_sec1
522
        attribute [JSCCustomGetter] Float64ArrayConstructor Float64Array; // Usable with new operator
522
        attribute [JSCCustomGetter] Float64ArrayConstructor Float64Array; // Usable with new operator
523
        attribute [JSCCustomGetter] DataViewConstructor DataView; // Usable with new operator
523
        attribute [JSCCustomGetter] DataViewConstructor DataView; // Usable with new operator
524
524
525
        attribute [JSCCustomGetter,Conditional=WEB_AUDIO,EnabledAtRuntime] AudioContextConstructor webkitAudioContext; // Usable with new operator
525
        attribute [Supplemented, JSCCustomGetter, Conditional=WEB_AUDIO, EnabledAtRuntime] AudioContextConstructor webkitAudioContext; // Usable with new operator
526
        attribute [Conditional=WEB_AUDIO] AudioPannerNodeConstructor webkitAudioPannerNode; // Needed for panning model constants
526
        attribute [Supplemented, Conditional=WEB_AUDIO] AudioPannerNodeConstructor webkitAudioPannerNode; // Needed for panning model constants
527
527
528
        // Event Constructors
528
        // Event Constructors
529
        attribute EventConstructor Event;
529
        attribute EventConstructor Event;
Lines 552-559 module window { a/Source/WebCore/page/DOMWindow.idl_sec2
552
        attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent;
552
        attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent;
553
        attribute [Conditional=WEB_SOCKETS] CloseEventConstructor CloseEvent;
553
        attribute [Conditional=WEB_SOCKETS] CloseEventConstructor CloseEvent;
554
        attribute StorageEventConstructor StorageEvent;
554
        attribute StorageEventConstructor StorageEvent;
555
        attribute [Conditional=WEB_AUDIO] AudioProcessingEventConstructor AudioProcessingEvent;
555
        attribute [Supplemented, Conditional=WEB_AUDIO] AudioProcessingEventConstructor AudioProcessingEvent;
556
        attribute [Conditional=WEB_AUDIO] OfflineAudioCompletionEventConstructor OfflineAudioCompletionEvent;
556
        attribute [Supplemented, Conditional=WEB_AUDIO] OfflineAudioCompletionEventConstructor OfflineAudioCompletionEvent;
557
        attribute [Conditional=INPUT_SPEECH] SpeechInputEventConstructor SpeechInputEvent;
557
        attribute [Conditional=INPUT_SPEECH] SpeechInputEventConstructor SpeechInputEvent;
558
        attribute [Conditional=MEDIA_STREAM] MediaStreamEventConstructor MediaStreamEvent;
558
        attribute [Conditional=MEDIA_STREAM] MediaStreamEventConstructor MediaStreamEvent;
559
        attribute [Conditional=WEBGL] WebGLContextEventConstructor WebGLContextEvent;
559
        attribute [Conditional=WEBGL] WebGLContextEventConstructor WebGLContextEvent;
- a/Source/WebCore/webaudio/DOMWindowWebAudio.idl +32 lines
Line 0 a/Source/WebCore/webaudio/DOMWindowWebAudio.idl_sec1
1
/*
2
 * Copyright (C) 2011 Google Inc. All rights reserved.
3
 *
4
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Library General Public
6
 * License as published by the Free Software Foundation; either
7
 * version 2 of the License, or (at your option) any later version.
8
 *
9
 * This library is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Library General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU Library General Public License
15
 * along with this library; see the file COPYING.LIB.  If not, write to
16
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
 * Boston, MA 02110-1301, USA.
18
 */
19
20
module window {
21
22
    interface [
23
        Conditional=WEB_AUDIO,
24
        Supplemental=DOMWindow
25
    ] DOMWindowWebAudio {
26
        attribute [JSCCustomGetter, EnabledAtRuntime] AudioContextConstructor webkitAudioContext;
27
        attribute AudioPannerNodeConstructor webkitAudioPannerNode;
28
        attribute AudioProcessingEventConstructor AudioProcessingEvent;
29
        attribute OfflineAudioCompletionEventConstructor OfflineAudioCompletionEvent;
30
    };
31
32
}

Return to Bug 73394