|  | # Copyright 2016 The Chromium Authors. All rights reserved. | 
|  | # Use of this source code is governed by a BSD-style license that can be | 
|  | # found in the LICENSE file. | 
|  |  | 
|  | import("//third_party/blink/renderer/bindings/bindings.gni") | 
|  | import("//third_party/blink/renderer/config.gni") | 
|  |  | 
|  | # The paths in this file are absolute since this file is imported and the | 
|  | # file lists must be valid from multiple "current directories". | 
|  |  | 
|  | # IDL files for a module are defined by idls.gni in the module's corresponding | 
|  | # directory. idls.gni can define certain variables to add additional IDL files | 
|  | # to the build. | 
|  | # | 
|  | #   modules_idl_files = [ | 
|  | #     # IDL files that don't fit in one of the below categories. Typically | 
|  | #     # (but not required to) defines interfaces. | 
|  | #     # Spec reference: https://heycam.github.io/webidl/#idl-interfaces | 
|  | #   ] | 
|  | # | 
|  | #   modules_callback_function_idl_files = [ | 
|  | #     # IDL files that only define callback functions (note: these are distinct | 
|  | #     # from callback interfaces). | 
|  | #     # Spec reference: https://heycam.github.io/webidl/#dfn-callback-function). | 
|  | #     # TODO(dcheng): Figure out why this is its own category. | 
|  | #   ] | 
|  | # | 
|  | #   modules_dictionary_idl_files = [ | 
|  | #     # IDL files that define dictionaries and any supporting types (such as | 
|  | #     # enums) for the dictionaries. | 
|  | #     # Spec reference: https://heycam.github.io/webidl/#idl-dictionaries | 
|  | #   ] | 
|  | # | 
|  | #   modules_dependency_idl_files = [ | 
|  | #     # IDL files that either define partial interfaces or target (right side | 
|  | #     # of) `includes`. | 
|  | #     # Spec reference: https://heycam.github.io/webidl/#dfn-partial-interface | 
|  | #     # Spec reference: https://heycam.github.io/webidl/#idl-interface-mixins | 
|  | #   ] | 
|  | # | 
|  | #   modules_testing_dependency_idl_files = [ | 
|  | #     # Similar to |modules_dependency_idl_files| but limited to things that are | 
|  | #     # exposed only for testing. | 
|  | #   ] | 
|  | # | 
|  | #   modules_typedefs_enums_only_idl_files = [ | 
|  | #     # IDL files that only have typedefs/enums. | 
|  | #   ] | 
|  | _idl_imports = [ | 
|  | "//third_party/blink/renderer/modules/accessibility/idls.gni", | 
|  | "//third_party/blink/renderer/modules/ad_auction/idls.gni", | 
|  | "//third_party/blink/renderer/modules/animationworklet/idls.gni", | 
|  | "//third_party/blink/renderer/modules/app_banner/idls.gni", | 
|  | "//third_party/blink/renderer/modules/audio_output_devices/idls.gni", | 
|  | "//third_party/blink/renderer/modules/background_fetch/idls.gni", | 
|  | "//third_party/blink/renderer/modules/background_sync/idls.gni", | 
|  | "//third_party/blink/renderer/modules/badging/idls.gni", | 
|  | "//third_party/blink/renderer/modules/battery/idls.gni", | 
|  | "//third_party/blink/renderer/modules/beacon/idls.gni", | 
|  | "//third_party/blink/renderer/modules/bluetooth/idls.gni", | 
|  | "//third_party/blink/renderer/modules/broadcastchannel/idls.gni", | 
|  | "//third_party/blink/renderer/modules/buckets/idls.gni", | 
|  | "//third_party/blink/renderer/modules/cache_storage/idls.gni", | 
|  | "//third_party/blink/renderer/modules/canvas/idls.gni", | 
|  | "//third_party/blink/renderer/modules/clipboard/idls.gni", | 
|  | "//third_party/blink/renderer/modules/compression/idls.gni", | 
|  | "//third_party/blink/renderer/modules/compute_pressure/idls.gni", | 
|  | "//third_party/blink/renderer/modules/contacts_picker/idls.gni", | 
|  | "//third_party/blink/renderer/modules/content_index/idls.gni", | 
|  | "//third_party/blink/renderer/modules/cookie_store/idls.gni", | 
|  | "//third_party/blink/renderer/modules/credentialmanager/idls.gni", | 
|  | "//third_party/blink/renderer/modules/crypto/idls.gni", | 
|  | "//third_party/blink/renderer/modules/csspaint/idls.gni", | 
|  | "//third_party/blink/renderer/modules/delegated_ink/idls.gni", | 
|  | "//third_party/blink/renderer/modules/managed_device/idls.gni", | 
|  | "//third_party/blink/renderer/modules/device_orientation/idls.gni", | 
|  | "//third_party/blink/renderer/modules/donottrack/idls.gni", | 
|  | "//third_party/blink/renderer/modules/encoding/idls.gni", | 
|  | "//third_party/blink/renderer/modules/encryptedmedia/idls.gni", | 
|  | "//third_party/blink/renderer/modules/eventsource/idls.gni", | 
|  | "//third_party/blink/renderer/modules/eyedropper/idls.gni", | 
|  | "//third_party/blink/renderer/modules/filesystem/idls.gni", | 
|  | "//third_party/blink/renderer/modules/file_system_access/idls.gni", | 
|  | "//third_party/blink/renderer/modules/font_access/idls.gni", | 
|  | "//third_party/blink/renderer/modules/gamepad/idls.gni", | 
|  | "//third_party/blink/renderer/modules/geolocation/idls.gni", | 
|  | "//third_party/blink/renderer/modules/handwriting/idls.gni", | 
|  | "//third_party/blink/renderer/modules/hid/idls.gni", | 
|  | "//third_party/blink/renderer/modules/idle/idls.gni", | 
|  | "//third_party/blink/renderer/modules/imagecapture/idls.gni", | 
|  | "//third_party/blink/renderer/modules/indexeddb/idls.gni", | 
|  | "//third_party/blink/renderer/modules/installedapp/idls.gni", | 
|  | "//third_party/blink/renderer/modules/keyboard/idls.gni", | 
|  | "//third_party/blink/renderer/modules/launch/idls.gni", | 
|  | "//third_party/blink/renderer/modules/locks/idls.gni", | 
|  | "//third_party/blink/renderer/modules/lock_screen/idls.gni", | 
|  | "//third_party/blink/renderer/modules/manifest/idls.gni", | 
|  | "//third_party/blink/renderer/modules/media_capabilities/idls.gni", | 
|  | "//third_party/blink/renderer/modules/mediacapturefromelement/idls.gni", | 
|  | "//third_party/blink/renderer/modules/mediarecorder/idls.gni", | 
|  | "//third_party/blink/renderer/modules/mediasession/idls.gni", | 
|  | "//third_party/blink/renderer/modules/mediasource/idls.gni", | 
|  | "//third_party/blink/renderer/modules/mediastream/idls.gni", | 
|  | "//third_party/blink/renderer/modules/breakout_box/idls.gni", | 
|  | "//third_party/blink/renderer/modules/modalclosewatcher/idls.gni", | 
|  | "//third_party/blink/renderer/modules/native_io/idls.gni", | 
|  | "//third_party/blink/renderer/modules/navigatorcontentutils/idls.gni", | 
|  | "//third_party/blink/renderer/modules/netinfo/idls.gni", | 
|  | "//third_party/blink/renderer/modules/nfc/idls.gni", | 
|  | "//third_party/blink/renderer/modules/notifications/idls.gni", | 
|  | "//third_party/blink/renderer/modules/payments/idls.gni", | 
|  | "//third_party/blink/renderer/modules/payments/goods/idls.gni", | 
|  | "//third_party/blink/renderer/modules/peerconnection/idls.gni", | 
|  | "//third_party/blink/renderer/modules/permissions/idls.gni", | 
|  | "//third_party/blink/renderer/modules/picture_in_picture/idls.gni", | 
|  | "//third_party/blink/renderer/modules/plugins/idls.gni", | 
|  | "//third_party/blink/renderer/modules/presentation/idls.gni", | 
|  | "//third_party/blink/renderer/modules/push_messaging/idls.gni", | 
|  | "//third_party/blink/renderer/modules/quota/idls.gni", | 
|  | "//third_party/blink/renderer/modules/remoteplayback/idls.gni", | 
|  | "//third_party/blink/renderer/modules/sanitizer_api/idls.gni", | 
|  | "//third_party/blink/renderer/modules/scheduler/idls.gni", | 
|  | "//third_party/blink/renderer/modules/screen_enumeration/idls.gni", | 
|  | "//third_party/blink/renderer/modules/screen_orientation/idls.gni", | 
|  | "//third_party/blink/renderer/modules/sensor/idls.gni", | 
|  | "//third_party/blink/renderer/modules/service_worker/idls.gni", | 
|  | "//third_party/blink/renderer/modules/shapedetection/idls.gni", | 
|  | "//third_party/blink/renderer/modules/speech/idls.gni", | 
|  | "//third_party/blink/renderer/modules/srcobject/idls.gni", | 
|  | "//third_party/blink/renderer/modules/storage/idls.gni", | 
|  | "//third_party/blink/renderer/modules/url_pattern/idls.gni", | 
|  | "//third_party/blink/renderer/modules/vibration/idls.gni", | 
|  | "//third_party/blink/renderer/modules/video_rvfc/idls.gni", | 
|  | "//third_party/blink/renderer/modules/virtualkeyboard/idls.gni", | 
|  | "//third_party/blink/renderer/modules/wake_lock/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webaudio/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webcodecs/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webdatabase/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webgl/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webgpu/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webid/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webmidi/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webshare/idls.gni", | 
|  | "//third_party/blink/renderer/modules/websockets/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webtransport/idls.gni", | 
|  | "//third_party/blink/renderer/modules/webusb/idls.gni", | 
|  | "//third_party/blink/renderer/modules/xr/idls.gni", | 
|  | ] | 
|  |  | 
|  | # TODO(dcheng): For whatever reason, is_android doesn't seem to be defined, even | 
|  | # if using import() instead of read_file() in the foreach() loop below... | 
|  | if (!is_android) { | 
|  | _idl_imports += [ | 
|  | "//third_party/blink/renderer/modules/direct_sockets/idls.gni", | 
|  | "//third_party/blink/renderer/modules/serial/idls.gni", | 
|  | ] | 
|  | } | 
|  |  | 
|  | # Do not add IDL files directly to these lists. See _idl_imports above instead | 
|  | # on how to add IDL files for a module. | 
|  | modules_idl_files = [] | 
|  | modules_callback_function_idl_files = [] | 
|  | modules_dictionary_idl_files = [] | 
|  | modules_dependency_idl_files = [] | 
|  | modules_testing_dependency_idl_files = [] | 
|  | modules_typedefs_enums_only_idl_files = [] | 
|  |  | 
|  | foreach(idl_import, _idl_imports) { | 
|  | # Avoid reassignment error by assigning to empty scope first. | 
|  | _imported = { | 
|  | } | 
|  | _imported = read_file(idl_import, "scope") | 
|  |  | 
|  | # Paths are potentially relative to the location of the .gni. Rebase them | 
|  | # relative to "." so get_path_info() works as expected. | 
|  | gni_dir = get_path_info(idl_import, "dir") | 
|  |  | 
|  | if (defined(_imported.modules_idl_files)) { | 
|  | modules_idl_files += | 
|  | get_path_info(rebase_path(_imported.modules_idl_files, ".", gni_dir), | 
|  | "abspath") | 
|  | } | 
|  |  | 
|  | if (defined(_imported.modules_callback_function_idl_files)) { | 
|  | modules_callback_function_idl_files += | 
|  | get_path_info(rebase_path(_imported.modules_callback_function_idl_files, | 
|  | ".", | 
|  | gni_dir), | 
|  | "abspath") | 
|  | } | 
|  |  | 
|  | if (defined(_imported.modules_dictionary_idl_files)) { | 
|  | modules_dictionary_idl_files += | 
|  | get_path_info( | 
|  | rebase_path(_imported.modules_dictionary_idl_files, ".", gni_dir), | 
|  | "abspath") | 
|  | } | 
|  |  | 
|  | if (defined(_imported.modules_dependency_idl_files)) { | 
|  | modules_dependency_idl_files += | 
|  | get_path_info( | 
|  | rebase_path(_imported.modules_dependency_idl_files, ".", gni_dir), | 
|  | "abspath") | 
|  | } | 
|  |  | 
|  | if (defined(_imported.modules_testing_dependency_idl_files)) { | 
|  | modules_testing_dependency_idl_files += | 
|  | get_path_info( | 
|  | rebase_path(_imported.modules_testing_dependency_idl_files, | 
|  | ".", | 
|  | gni_dir), | 
|  | "abspath") | 
|  | } | 
|  |  | 
|  | if (defined(_imported.modules_typedefs_enums_only_idl_files)) { | 
|  | modules_typedefs_enums_only_idl_files += | 
|  | get_path_info( | 
|  | rebase_path(_imported.modules_typedefs_enums_only_idl_files, | 
|  | ".", | 
|  | gni_dir), | 
|  | "abspath") | 
|  | } | 
|  | } | 
|  |  | 
|  | bindings_modules_output_dir = "$bindings_output_dir/modules" | 
|  | blink_modules_output_dir = "$root_gen_dir/third_party/blink/renderer/modules" | 
|  |  | 
|  | modules_core_global_constructors_original_interfaces = [ | 
|  | "AnimationWorkletGlobalScope", | 
|  | "AudioWorkletGlobalScope", | 
|  | "PaintWorkletGlobalScope", | 
|  | "ServiceWorkerGlobalScope", | 
|  | ] | 
|  |  | 
|  | # The size and the order in the following list must match to the previous one. | 
|  | modules_core_global_constructors_original_interface_basenames = [ | 
|  | "animation_worklet_global_scope", | 
|  | "audio_worklet_global_scope", | 
|  | "paint_worklet_global_scope", | 
|  | "service_worker_global_scope", | 
|  | ] | 
|  |  | 
|  | modules_global_constructors_original_interfaces = [ | 
|  | "AnimationWorkletGlobalScope", | 
|  | "AudioWorkletGlobalScope", | 
|  | "DedicatedWorkerGlobalScope", | 
|  | "PaintWorkletGlobalScope", | 
|  | "ServiceWorkerGlobalScope", | 
|  | "SharedWorkerGlobalScope", | 
|  | "Window", | 
|  | ] | 
|  |  | 
|  | # The size and the order in the following list must match to the previous one. | 
|  | modules_global_constructors_original_interface_basenames = [ | 
|  | "animation_worklet_global_scope", | 
|  | "audio_worklet_global_scope", | 
|  | "dedicated_worker_global_scope", | 
|  | "paint_worklet_global_scope", | 
|  | "service_worker_global_scope", | 
|  | "shared_worker_global_scope", | 
|  | "window", | 
|  | ] | 
|  |  | 
|  | # The interfaces aren't technically files, but we can treat them as file names | 
|  | # to get process_file_template to generate lists of IDL files corresponding | 
|  | # to each interface. | 
|  | modules_core_global_constructors_generated_idl_files = process_file_template( | 
|  | modules_core_global_constructors_original_interface_basenames, | 
|  | [ "$blink_modules_output_dir/{{source_name_part}}_core_constructors.idl" ]) | 
|  | modules_global_constructors_generated_idl_files = process_file_template( | 
|  | modules_global_constructors_original_interface_basenames, | 
|  | [ "$blink_modules_output_dir/{{source_name_part}}_modules_constructors.idl" ]) | 
|  |  | 
|  | modules_definition_idl_files = modules_dictionary_idl_files + modules_idl_files | 
|  |  | 
|  | # Static IDL files | 
|  | modules_static_interface_idl_files = | 
|  | modules_callback_function_idl_files + modules_typedefs_enums_only_idl_files | 
|  |  | 
|  | modules_static_dependency_idl_files = | 
|  | modules_dependency_idl_files + modules_testing_dependency_idl_files | 
|  |  | 
|  | if (use_blink_v8_binding_new_idl_interface) { | 
|  | modules_generated_dependency_idl_files = [] | 
|  | } else { | 
|  | modules_generated_dependency_idl_files = | 
|  | modules_core_global_constructors_generated_idl_files + | 
|  | modules_global_constructors_generated_idl_files | 
|  | } | 
|  |  | 
|  | # 'modules_dependency_idl_files' is already used in Source/modules, so avoid | 
|  | # collision | 
|  | modules_all_dependency_idl_files = | 
|  | modules_static_dependency_idl_files + modules_generated_dependency_idl_files |