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

Unified Diff: Tools/Scripts/webkitpy/bindings/main.py

Issue 671863002: IDL: Avoid global variables in compute_interfaces_info_individual.py (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
Index: Tools/Scripts/webkitpy/bindings/main.py
diff --git a/Tools/Scripts/webkitpy/bindings/main.py b/Tools/Scripts/webkitpy/bindings/main.py
index cbc38cec11b87888433ed96f0fec7ffba37ab242..8d8928eac228f0c6e281e52dad99903dce1bf025 100644
--- a/Tools/Scripts/webkitpy/bindings/main.py
+++ b/Tools/Scripts/webkitpy/bindings/main.py
@@ -41,7 +41,7 @@ source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir,
sys.path.append(source_path) # for Source/bindings imports
import bindings.scripts.compute_interfaces_info_individual
-from bindings.scripts.compute_interfaces_info_individual import compute_info_individual, info_individual
+from bindings.scripts.compute_interfaces_info_individual import InterfaceInfoGeneratorIndividual
import bindings.scripts.compute_interfaces_info_overall
from bindings.scripts.compute_interfaces_info_overall import compute_interfaces_info_overall, interfaces_info
from bindings.scripts.idl_compiler import IdlCompilerDictionaryImpl, IdlCompilerV8
@@ -112,6 +112,14 @@ def generate_interface_dependencies(output_directory):
for filename in fnmatch.filter(files, '*.idl'))
return idl_paths
+ def collect_blink_idl_paths():
+ """Returns IDL file paths which blink actually uses."""
+ idl_paths = []
+ for component in COMPONENT_DIRECTORY:
+ directory = os.path.join(source_path, component)
+ idl_paths.extend(idl_paths_recursive(directory))
+ return idl_paths
+
# We compute interfaces info for *all* IDL files, not just test IDL
# files, as code generator output depends on inheritance (both ancestor
# chain and inherited extended attributes), and some real interfaces
@@ -122,14 +130,8 @@ def generate_interface_dependencies(output_directory):
# since this is also special-cased and Node inherits from EventTarget,
# but this inheritance information requires computing dependencies for
# the real Node.idl file.
- non_test_idl_paths = []
- test_idl_paths = []
- test_idl_dir = test_input_directory + os.sep
- for idl_path in idl_paths_recursive(source_path):
- if idl_path.startswith(test_idl_dir):
- test_idl_paths.append(idl_path)
- else:
- non_test_idl_paths.append(idl_path)
+ non_test_idl_paths = collect_blink_idl_paths()
+ test_idl_paths = idl_paths_recursive(test_input_directory)
# 2-stage computation: individual, then overall
#
# Properly should compute separately by component (currently test
@@ -140,13 +142,15 @@ def generate_interface_dependencies(output_directory):
# In order to allow test IDL files to override the production IDL files if
# they have the same interface name, process the test IDL files after the
# non-test IDL files.
- reader = IdlReader(outputdir=output_directory)
+ info_individuals = []
+ info_generator_individual = InterfaceInfoGeneratorIndividual(
+ cache_directory=output_directory)
for idl_path_list in (non_test_idl_paths, test_idl_paths):
for idl_path in idl_path_list:
if os.path.basename(idl_path) in NON_BLINK_IDL_FILES:
continue
- compute_info_individual(idl_path, reader)
- info_individuals = [info_individual()]
+ info_generator_individual.compute_info(idl_path)
+ info_individuals.append(info_generator_individual.get_info_as_dict())
bashi 2014/10/22 09:43:30 No actual change here in this CL, but I'm planning
# TestDictionary.{h,cpp} are placed under Source/bindings/tests/idls/core.
# However, IdlCompiler generates TestDictionary.{h,cpp} by using relative_dir.
# So the files will be generated under output_dir/core/bindings/tests/idls/core.

Powered by Google App Engine
This is Rietveld 408576698