Flutter Engine
The Flutter Engine
Functions | Variables
scripts.fremontcutbuilder Namespace Reference

Functions

def ResolveAllTypedefs (all_interfaces)
 
def build_database (idl_files, database_dir, feature_defines=None, logging_level=logging.WARNING, examine_idls=False)
 
def main (parallel=False, logging_level=logging.WARNING, examine_idls=False)
 

Variables

list FEATURE_DISABLED
 
list FEATURE_DEFINES
 

Function Documentation

◆ build_database()

def scripts.fremontcutbuilder.build_database (   idl_files,
  database_dir,
  feature_defines = None,
  logging_level = logging.WARNING,
  examine_idls = False 
)
This code reconstructs the FremontCut IDL database from W3C,
WebKit and Dart IDL files.

Definition at line 67 of file fremontcutbuilder.py.

71 examine_idls=False):
72 """This code reconstructs the FremontCut IDL database from W3C,
73 WebKit and Dart IDL files."""
74 current_dir = os.path.dirname(__file__)
75 logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))
76
77 _logger.setLevel(logging_level)
78
79 db = database.Database(database_dir)
80
81 # Delete all existing IDLs in the DB.
82 db.Delete()
83
84 builder = databasebuilder.DatabaseBuilder(db)
86
87 # TODO(vsm): Move this to a README.
88 # This is the Chrome revision.
89 webkit_revision = '63'
90
91 # TODO(vsm): Reconcile what is exposed here and inside WebKit code
92 # generation. We need to recheck this periodically for now.
93 webkit_defines = ['LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT']
94
95 if feature_defines is None:
96 feature_defines = FEATURE_DEFINES
97
98 webkit_options = databasebuilder.DatabaseBuilderOptions(
99 # TODO(vsm): What else should we define as on when processing IDL?
100 idl_defines=webkit_defines + feature_defines,
101 source='WebKit',
102 source_attributes={'revision': webkit_revision},
103 logging_level=logging_level)
104
105 # Import WebKit IDLs.
106 builder.import_idl_files(idl_files, webkit_options, False)
107
108 # Import Dart idl:
109 dart_options = databasebuilder.DatabaseBuilderOptions(
110 source='Dart',
111 rename_operation_arguments_on_merge=True,
112 logging_level=logging_level)
113
114 utilities.KNOWN_COMPONENTS = frozenset(['core', 'modules', 'dart'])
115
116 builder.import_idl_files(
117 [os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl')],
118 dart_options, True)
119
120 start_time = time.time()
121
122 # All typedefs MUST be resolved here before any database fixups (merging, implements, etc.)
123 ResolveAllTypedefs(builder._imported_interfaces)
124
125 # Merging:
126 builder.merge_imported_interfaces()
127
128 builder.fetch_constructor_data(webkit_options)
129 builder.fix_displacements('WebKit')
130
131 # Cleanup:
132 builder.normalize_annotations(['WebKit', 'Dart'])
133
134 # Map any IDL defined dictionaries to Dictionary.
135 builder.map_dictionaries()
136
137 # Examine all IDL and produce a diagnoses of areas (e.g., list dictionaries
138 # declared and usage, etc.)
139 if examine_idls:
140 builder.examine_database()
141
142 conditionals_met = set(
143 'ENABLE_' + conditional for conditional in builder.conditionals_met)
144 known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED)
145
146 unused_conditionals = known_conditionals - conditionals_met
147 if unused_conditionals:
148 _logger.warning('There are some unused conditionals %s' %
149 sorted(unused_conditionals))
150 _logger.warning('Please update fremontcutbuilder.py')
151
152 unknown_conditionals = conditionals_met - known_conditionals
153 if unknown_conditionals:
154 _logger.warning('There are some unknown conditionals %s' %
155 sorted(unknown_conditionals))
156 _logger.warning('Please update fremontcutbuilder.py')
157
158 print('Merging interfaces %s seconds' % round(time.time() - start_time, 2))
159
160 return db
161
162
static void round(SkPoint *p)
def set_builder(created_builder)
Definition: dependency.py:4
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
Definition: switches.h:76
def print(*args, **kwargs)
Definition: run_tests.py:49
def ResolveAllTypedefs(all_interfaces)

◆ main()

def scripts.fremontcutbuilder.main (   parallel = False,
  logging_level = logging.WARNING,
  examine_idls = False 
)

Definition at line 163 of file fremontcutbuilder.py.

163def main(parallel=False, logging_level=logging.WARNING, examine_idls=False):
164 current_dir = os.path.dirname(__file__)
165
166 idl_files = []
167
168 # Check default location in a regular dart enlistment.
169 webcore_dir = os.path.join(current_dir, '..', '..', '..', 'third_party',
170 'WebCore')
171
172 if not os.path.exists(webcore_dir):
173 # Check default location in a dartium enlistment.
174 webcore_dir = os.path.join(current_dir, '..', '..', '..', '..',
175 'third_party', 'WebKit', 'Source')
176
177 if not os.path.exists(webcore_dir):
178 raise RuntimeError('directory not found: %s' % webcore_dir)
179
180 DIRS_TO_IGNORE = [
181 'bindings', # Various test IDLs
182 'testing', # IDLs to expose testing APIs
183 'networkinfo', # Not yet used in Blink yet
184 'vibration', # Not yet used in Blink yet
185 'inspector',
186 'idl_parser', # idl_parser has test IDL files.
187 ]
188
189 # TODO(terry): Integrate this into the htmlrenamer's _removed_html_interfaces
190 # (if possible).
191 FILES_TO_IGNORE = [
192 'InspectorFrontendHostFileSystem.idl', # Uses interfaces in inspector dir (which is ignored)
193 'WebKitGamepad.idl', # Gamepad.idl is the new one.
194 'WebKitGamepadList.idl', # GamepadList is the new one.
195 ]
196
197 for (dir_name, dirs, files) in os.walk(webcore_dir):
198 if os.path.basename(dir_name) in DIRS_TO_IGNORE:
199 dirs[:] = [] # Do not go underneath
200 else:
201 for name in files:
202 file_name = os.path.join(dir_name, name)
203 (interface, ext) = os.path.splitext(file_name)
204 if ext == '.idl' and not (name in FILES_TO_IGNORE):
205 idl_files.append(file_name)
206
207 database_dir = os.path.join(current_dir, '..', 'database')
208
209 return build_database(
210 idl_files,
211 database_dir,
212 logging_level=logging_level,
213 examine_idls=examine_idls)
214
215
def build_database(idl_files, database_dir, feature_defines=None, logging_level=logging.WARNING, examine_idls=False)
def main(parallel=False, logging_level=logging.WARNING, examine_idls=False)

◆ ResolveAllTypedefs()

def scripts.fremontcutbuilder.ResolveAllTypedefs (   all_interfaces)

Definition at line 45 of file fremontcutbuilder.py.

45def ResolveAllTypedefs(all_interfaces):
46 # Resolve all typedefs.
47 for interface, db_Opts in all_interfaces:
48
49 def IsIdentified(idl_node):
50 node_name = idl_node.id if idl_node.id else 'parent'
51 for idl_type in idl_node.all(idlnode.IDLType):
52 # One last check is the type a typedef in an IDL file (the typedefs
53 # are treated as global).
54 resolvedType = resolveTypedef(idl_type)
55 if (resolvedType != idl_type):
56 idl_type.id = resolvedType.id
57 idl_type.nullable = resolvedType.nullable
58 continue
59 return True
60
61 interface.constants = list(filter(IsIdentified, interface.constants))
62 interface.attributes = list(filter(IsIdentified, interface.attributes))
63 interface.operations = list(filter(IsIdentified, interface.operations))
64 interface.parents = list(filter(IsIdentified, interface.parents))
65
66
def resolveTypedef(type)
Definition: idlnode.py:39

Variable Documentation

◆ FEATURE_DEFINES

list scripts.fremontcutbuilder.FEATURE_DEFINES
Initial value:
1= [
2 'ENABLE_CALENDAR_PICKER', # Not on Android
3 'ENABLE_ENCRYPTED_MEDIA_V2',
4 'ENABLE_INPUT_SPEECH', # Not on Android
5 'ENABLE_LEGACY_NOTIFICATIONS', # Not on Android
6 'ENABLE_NAVIGATOR_CONTENT_UTILS', # Not on Android
7 'ENABLE_NOTIFICATIONS', # Not on Android
8 'ENABLE_SVG_FONTS',
9 'ENABLE_WEB_AUDIO', # Not on Android
10]

Definition at line 30 of file fremontcutbuilder.py.

◆ FEATURE_DISABLED

list scripts.fremontcutbuilder.FEATURE_DISABLED
Initial value:
1= [
2 'ENABLE_CUSTOM_SCHEME_HANDLER',
3 'ENABLE_MEDIA_CAPTURE', # Only enabled on Android.
4 'ENABLE_ORIENTATION_EVENTS', # Only enabled on Android.
5 'ENABLE_WEBVTT_REGIONS',
6]

Definition at line 23 of file fremontcutbuilder.py.