Commit 3bc91fa4 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

CodeGen: Change output paths of generated files for dictionary

Changes output path of dictionary files from

  third_party/blink/(core|modules)/xxx/yyy/zzz.{h,cc}

to

  third_party/blink/bindings/(core|modules)/v8/v8_zzz.{h,cc}


Bug: 839389, 1034398
Change-Id: I47504d8bd263b07d8ff74c8306bb48e702580f28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2004363
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732742}
parent 11362212
...@@ -42,6 +42,7 @@ idl_compiler("generate_bindings_core_v8_interfaces") { ...@@ -42,6 +42,7 @@ idl_compiler("generate_bindings_core_v8_interfaces") {
generated_webcore_testing_idl_files generated_webcore_testing_idl_files
if (use_v8_bind_gen_for_dictionary) { if (use_v8_bind_gen_for_dictionary) {
sources -= core_dictionary_idl_files sources -= core_dictionary_idl_files
sources -= core_testing_dictionary_idl_files
} }
output_dir = bindings_core_v8_output_dir output_dir = bindings_core_v8_output_dir
output_name_suffix = "" output_name_suffix = ""
......
...@@ -209,23 +209,32 @@ generated_demo_files = [] ...@@ -209,23 +209,32 @@ generated_demo_files = []
if (use_v8_bind_gen_for_dictionary) { if (use_v8_bind_gen_for_dictionary) {
generated_core_dictionary_files += generated_core_dictionary_files +=
process_file_template(core_dictionary_idl_files, process_file_template(
[ core_dictionary_idl_files,
"{{source_gen_dir}}/{{source_name_part}}.cc", [
"{{source_gen_dir}}/{{source_name_part}}.h", "$bindings_core_v8_output_dir/v8_{{source_name_part}}.cc",
]) "$bindings_core_v8_output_dir/v8_{{source_name_part}}.h",
])
generated_core_testing_dictionary_files =
process_file_template(
core_testing_dictionary_idl_files,
[
"$bindings_core_v8_output_dir/v8_{{source_name_part}}.cc",
"$bindings_core_v8_output_dir/v8_{{source_name_part}}.h",
])
# Generated file from demonstration_and_testing.idl, which won't be compiled. # Generated file from demonstration_and_testing.idl, which won't be compiled.
generated_demo_files += [ generated_demo_files += [
"$bindings_scripts_output_dir/web_idl/example_dictionary.cc", "$bindings_core_v8_output_dir/v8_example_dictionary.cc",
"$bindings_scripts_output_dir/web_idl/example_dictionary.h", "$bindings_core_v8_output_dir/v8_example_dictionary.h",
] ]
} else {
generated_core_testing_dictionary_files =
process_file_template(
core_testing_dictionary_idl_files,
[
"$blink_core_output_dir/testing/{{source_name_part}}.cc",
"$blink_core_output_dir/testing/{{source_name_part}}.h",
])
} }
generated_core_testing_dictionary_files =
process_file_template(
core_testing_dictionary_idl_files,
[
"$blink_core_output_dir/testing/{{source_name_part}}.cc",
"$blink_core_output_dir/testing/{{source_name_part}}.h",
])
...@@ -173,9 +173,10 @@ generated_modules_dictionary_files = [] ...@@ -173,9 +173,10 @@ generated_modules_dictionary_files = []
if (use_v8_bind_gen_for_dictionary) { if (use_v8_bind_gen_for_dictionary) {
generated_modules_dictionary_files += generated_modules_dictionary_files +=
process_file_template(modules_dictionary_idl_files, process_file_template(
[ modules_dictionary_idl_files,
"{{source_gen_dir}}/{{source_name_part}}.cc", [
"{{source_gen_dir}}/{{source_name_part}}.h", "$bindings_modules_v8_output_dir/v8_{{source_name_part}}.cc",
]) "$bindings_modules_v8_output_dir/v8_{{source_name_part}}.h",
])
} }
...@@ -154,8 +154,6 @@ def collect_include_headers(idl_definition): ...@@ -154,8 +154,6 @@ def collect_include_headers(idl_definition):
for type_def_obj in type_def_objs: for type_def_obj in type_def_objs:
if isinstance(type_def_obj, web_idl.Enumeration): if isinstance(type_def_obj, web_idl.Enumeration):
continue continue
if isinstance(type_def_obj, web_idl.Dictionary):
header_paths.add(PathManager(type_def_obj).dict_path(ext="h"))
header_paths.add(PathManager(type_def_obj).api_path(ext="h")) header_paths.add(PathManager(type_def_obj).api_path(ext="h"))
return header_paths return header_paths
...@@ -188,9 +186,6 @@ def collect_include_headers_of_idl_types(idl_types): ...@@ -188,9 +186,6 @@ def collect_include_headers_of_idl_types(idl_types):
header_paths.add( header_paths.add(
"third_party/blink/renderer/platform/heap/handle.h") "third_party/blink/renderer/platform/heap/handle.h")
type_def_obj = idl_type.type_definition_object type_def_obj = idl_type.type_definition_object
# TODO(crbug.com/1034398): Remove this hack
if idl_type.is_dictionary:
header_paths.add(PathManager(type_def_obj).dict_path(ext="h"))
header_paths.add(PathManager(type_def_obj).api_path(ext="h")) header_paths.add(PathManager(type_def_obj).api_path(ext="h"))
elif (idl_type.is_sequence or idl_type.is_frozen_array elif (idl_type.is_sequence or idl_type.is_frozen_array
or idl_type.is_variadic or idl_type.is_record): or idl_type.is_variadic or idl_type.is_record):
......
...@@ -614,8 +614,8 @@ def generate_dictionary(dictionary): ...@@ -614,8 +614,8 @@ def generate_dictionary(dictionary):
base_class_name=base_class_name) base_class_name=base_class_name)
# Filepaths # Filepaths
header_path = path_manager.dict_path(ext="h") header_path = path_manager.api_path(ext="h")
source_path = path_manager.dict_path(ext="cc") source_path = path_manager.api_path(ext="cc")
# Root nodes # Root nodes
header_node = ListNode(tail="\n") header_node = ListNode(tail="\n")
...@@ -634,10 +634,7 @@ def generate_dictionary(dictionary): ...@@ -634,10 +634,7 @@ def generate_dictionary(dictionary):
# Header part (copyright, include directives, and forward declarations) # Header part (copyright, include directives, and forward declarations)
if dictionary.inherited: if dictionary.inherited:
# TODO(crbug.com/1034398): Use api_path() or impl_path() once we base_class_header = PathManager(dictionary.inherited).api_path(ext="h")
# migrate IDL compiler and move generated code of dictionaries.
base_class_header = PathManager(
dictionary.inherited).dict_path(ext="h")
else: else:
base_class_header = ( base_class_header = (
"third_party/blink/renderer/platform/bindings/dictionary_base.h") "third_party/blink/renderer/platform/bindings/dictionary_base.h")
......
...@@ -76,15 +76,6 @@ class PathManager(object): ...@@ -76,15 +76,6 @@ class PathManager(object):
def __init__(self, idl_definition): def __init__(self, idl_definition):
assert self._is_initialized, self._REQUIRE_INIT_MESSAGE assert self._is_initialized, self._REQUIRE_INIT_MESSAGE
if isinstance(idl_definition, web_idl.Dictionary):
idl_path = PathManager.relpath_to_project_root(
posixpath.normpath(
idl_definition.debug_info.location.filepath))
idl_basepath, _ = posixpath.splitext(idl_path)
self._idl_dir, _ = posixpath.split(idl_basepath)
else:
self._idl_dir = None
components = sorted(idl_definition.components) # "core" < "modules" components = sorted(idl_definition.components) # "core" < "modules"
if len(components) == 0: if len(components) == 0:
...@@ -113,8 +104,6 @@ class PathManager(object): ...@@ -113,8 +104,6 @@ class PathManager(object):
self._impl_dir = self._component_reldirs[self._impl_component] self._impl_dir = self._component_reldirs[self._impl_component]
self._v8_bind_basename = name_style.file("v8", self._v8_bind_basename = name_style.file("v8",
idl_definition.identifier) idl_definition.identifier)
self._blink_basename = name_style.file(
blink_class_name(idl_definition))
@property @property
def is_cross_components(self): def is_cross_components(self):
...@@ -148,14 +137,6 @@ class PathManager(object): ...@@ -148,14 +137,6 @@ class PathManager(object):
filename=(filename or self._v8_bind_basename), filename=(filename or self._v8_bind_basename),
ext=ext) ext=ext)
# TODO(crbug.com/1034398): Remove this API
def dict_path(self, filename=None, ext=None):
assert self._idl_dir is not None
return self._join(
dirpath=self._idl_dir,
filename=(filename or self._blink_basename),
ext=ext)
@staticmethod @staticmethod
def _join(dirpath, filename, ext=None): def _join(dirpath, filename, ext=None):
if ext is not None: if ext is not None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment