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

Unified Diff: lib/html/scripts/dartdomgenerator.py

Issue 10987042: Speed up fremontcut/dartdomgenerator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: One more fix Created 8 years, 3 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 | « no previous file | lib/html/scripts/databasebuilder.py » ('j') | lib/html/scripts/databasebuilder.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/html/scripts/dartdomgenerator.py
diff --git a/lib/html/scripts/dartdomgenerator.py b/lib/html/scripts/dartdomgenerator.py
index b2f462ccca2b38c3040d1e5fd01a1883618759fb..31518d2d901d8ae0151ef161778937e1220b0207 100755
--- a/lib/html/scripts/dartdomgenerator.py
+++ b/lib/html/scripts/dartdomgenerator.py
@@ -7,6 +7,7 @@
import dartgenerator
import database
+import fremontcutbuilder
import logging.config
import multiemitter
import optparse
@@ -38,20 +39,28 @@ _webkit_renames = {
'Window': 'DOMWindow',
'WorkerGlobalScope': 'WorkerContext'}
+# TODO(vsm): Remove once we fix Dartium to pass in the database directly.
def Generate(database_dir, use_database_cache, dart2js_output_dir=None,
dartium_output_dir=None):
- current_dir = os.path.dirname(__file__)
- auxiliary_dir = os.path.join(current_dir, '..', 'src')
- template_dir = os.path.join(current_dir, '..', 'templates')
-
- generator = dartgenerator.DartGenerator()
- generator.LoadAuxiliary(auxiliary_dir)
+ database = LoadDatabase(database_dir, use_database_cache)
+ GenerateFromDatabase(database, dart2js_output_dir, dartium_output_dir)
+def LoadDatabase(database_dir, use_database_cache):
common_database = database.Database(database_dir)
if use_database_cache:
common_database.LoadFromCache()
else:
common_database.Load()
+ return common_database
+
+def GenerateFromDatabase(common_database, dart2js_output_dir,
+ dartium_output_dir):
+ current_dir = os.path.dirname(__file__)
+ auxiliary_dir = os.path.join(current_dir, '..', 'src')
+ template_dir = os.path.join(current_dir, '..', 'templates')
+
+ generator = dartgenerator.DartGenerator()
+ generator.LoadAuxiliary(auxiliary_dir)
generator.FilterMembersWithUnidentifiedTypes(common_database)
webkit_database = common_database.Clone()
@@ -133,6 +142,9 @@ def GenerateSingleFile(library_path, output_dir):
def main():
parser = optparse.OptionParser()
+ parser.add_option('--rebuild', dest='rebuild',
+ action='store_true', default=False,
+ help='Rebuild the database from IDL using fremontcut.')
parser.add_option('--systems', dest='systems',
action='store', type='string',
default='htmldart2js,htmldartium',
@@ -161,8 +173,14 @@ def main():
if 'htmldartium' in systems:
dartium_output_dir = os.path.join(output_dir, 'dartium')
- Generate(database_dir, options.use_database_cache, dart2js_output_dir,
- dartium_output_dir)
+ if options.rebuild:
+ # Parse the IDL and create the database.
+ database = fremontcutbuilder.main()
+ else:
+ # Load the previously generated database.
+ database = LoadDatabase(database_dir, options.use_database_cache)
+ GenerateFromDatabase(database, dart2js_output_dir,
Anton Muhin 2012/09/26 17:53:09 nit: fits single line?
vsm 2012/09/28 16:17:25 Done.
+ dartium_output_dir)
if 'htmldart2js' in systems:
_logger.info('Copy html_dart2js to dart2js/')
« no previous file with comments | « no previous file | lib/html/scripts/databasebuilder.py » ('j') | lib/html/scripts/databasebuilder.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698