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

Unified Diff: tools/dom/scripts/databasebuilder.py

Issue 605083004: Merge 38 changes to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « tools/dom/scripts/dartmetadata.py ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/databasebuilder.py
diff --git a/tools/dom/scripts/databasebuilder.py b/tools/dom/scripts/databasebuilder.py
index 01e4bd6496f2e96f3e627e3934ae32873daa0d19..d0fe7b66d1e3e3b698b3c5f0ad790adb8dfc6914 100755
--- a/tools/dom/scripts/databasebuilder.py
+++ b/tools/dom/scripts/databasebuilder.py
@@ -7,6 +7,7 @@ import copy
import database
import idlparser
import logging
+import monitored
import multiprocessing
import os
import os.path
@@ -196,16 +197,23 @@ class DatabaseBuilder(object):
# Spin up the new IDL parser.
self.build = Build(None)
+ # Global typedef to mapping.
+ self.global_type_defs = monitored.Dict('databasebuilder.global_type_defs', {
+ 'Transferable' : 'MessagePort',
+ })
+
+ # TODO(terry): Consider keeping richer type information (e.g.,
+ # IdlArrayOrSequenceType from the Blink parser) instead of just
+ # a type name.
def _resolve_type_defs(self, idl_file):
- type_def_map = {}
- # build map
- for type_def in idl_file.typeDefs:
- if type_def.type.id != type_def.id: # sanity check
- type_def_map[type_def.id] = type_def.type.id
- # use the map
for type_node in idl_file.all(IDLType):
- while type_node.id in type_def_map:
- type_node.id = type_def_map[type_node.id]
+ type_name = type_node.id
+ for typedef in self.global_type_defs:
+ seq_name_typedef = 'sequence<%s>' % typedef
+ if type_name == typedef:
+ type_node.id = self.global_type_defs[typedef]
+ elif type_name == seq_name_typedef:
+ type_node.id = 'sequence<%s>' % self.global_type_defs[typedef]
def _strip_ext_attributes(self, idl_file):
"""Strips unuseful extended attributes."""
« no previous file with comments | « tools/dom/scripts/dartmetadata.py ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698