Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: bindings/scripts/generate_global_constructors.py

Issue 1660113002: Updated to Chrome 45 (2454) moved from SVN to git. Base URL: https://github.com/dart-lang/webcore.git@roll_45
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bindings/scripts/generate_event_interfaces.py ('k') | bindings/scripts/generate_init_partial_interfaces.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/generate_global_constructors.py
diff --git a/bindings/scripts/generate_global_constructors.py b/bindings/scripts/generate_global_constructors.py
index 1be2ac3327c730f529759f552f658bfeff42f7c5..5ad7ff664b51706f180f076f4b88c0789551df4b 100755
--- a/bindings/scripts/generate_global_constructors.py
+++ b/bindings/scripts/generate_global_constructors.py
@@ -24,8 +24,10 @@ import cPickle as pickle
import re
import sys
+from v8_utilities import EXPOSED_EXECUTION_CONTEXT_METHOD
+
from collections import defaultdict
-from utilities import get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl
+from utilities import should_generate_impl_file_from_idl, get_file_contents, idl_filename_to_interface_name, read_file_to_list, write_file, get_interface_extended_attributes_from_idl, get_interface_exposed_arguments, is_callback_interface_from_idl
interface_name_to_global_names = {}
global_name_to_constructors = defaultdict(list)
@@ -77,25 +79,33 @@ def record_global_constructors(idl_filename):
# Callback interfaces with constants also have interface properties,
# but there are none of these in Blink.
# http://heycam.github.io/webidl/#es-interfaces
- if (is_callback_interface_from_idl(idl_file_contents) or
+ if ((not should_generate_impl_file_from_idl(idl_file_contents)) or
+ is_callback_interface_from_idl(idl_file_contents) or
'NoInterfaceObject' in extended_attributes):
return
- # The [Exposed] extended attribute MUST take an identifier list. Each
- # identifier in the list MUST be a global name. An interface or interface
- # member the extended attribute applies to will be exposed only on objects
- # associated with ECMAScript global environments whose global object
- # implements an interface that has a matching global name.
- exposed_global_names = extended_attributes.get('Exposed', 'Window').strip('()').split(',')
- new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
- for exposed_global_name in exposed_global_names:
- global_name_to_constructors[exposed_global_name].extend(new_constructors_list)
+ exposed_arguments = get_interface_exposed_arguments(idl_file_contents)
+ if exposed_arguments:
+ # Exposed(Arguments) case
+ for argument in exposed_arguments:
+ if 'RuntimeEnabled' in extended_attributes:
+ raise ValueError('RuntimeEnabled should not be used with Exposed(Arguments)')
+ attributes = extended_attributes.copy()
+ attributes['RuntimeEnabled'] = argument['runtime_enabled']
+ new_constructors_list = generate_global_constructors_list(interface_name, attributes)
+ global_name_to_constructors[argument['exposed']].extend(new_constructors_list)
+ else:
+ # Exposed=env or Exposed=(env1,...) case
+ exposed_global_names = extended_attributes.get('Exposed', 'Window').strip('()').split(',')
+ new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
+ for name in exposed_global_names:
+ global_name_to_constructors[name].extend(new_constructors_list)
def generate_global_constructors_list(interface_name, extended_attributes):
extended_attributes_list = [
name + '=' + extended_attributes[name]
- for name in 'Conditional', 'PerContextEnabled', 'RuntimeEnabled'
+ for name in 'Conditional', 'RuntimeEnabled'
if name in extended_attributes]
if extended_attributes_list:
extended_string = '[%s] ' % ', '.join(extended_attributes_list)
@@ -158,7 +168,7 @@ def main():
record_global_constructors(idl_filename)
# Check for [Exposed] / [Global] mismatch.
- known_global_names = frozenset(itertools.chain.from_iterable(interface_name_to_global_names.values()))
+ known_global_names = EXPOSED_EXECUTION_CONTEXT_METHOD.keys()
exposed_global_names = frozenset(global_name_to_constructors)
if not exposed_global_names.issubset(known_global_names):
unknown_global_names = exposed_global_names.difference(known_global_names)
« no previous file with comments | « bindings/scripts/generate_event_interfaces.py ('k') | bindings/scripts/generate_init_partial_interfaces.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698