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

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

Issue 952133004: Changes to support roll 39 IDLs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 5 years, 10 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/databasebuilder.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/database.py
diff --git a/tools/dom/scripts/database.py b/tools/dom/scripts/database.py
index 7bb509338291dad1b338008df5c566993d270e51..951a3415733789c57b3560326312288a8ec9de7b 100755
--- a/tools/dom/scripts/database.py
+++ b/tools/dom/scripts/database.py
@@ -43,6 +43,7 @@ class Database(object):
self._all_interfaces = {}
self._interfaces_to_delete = []
self._enums = {}
+ self._all_dictionaries = {}
def Clone(self):
new_database = Database(self._root_dir)
@@ -50,6 +51,8 @@ class Database(object):
new_database._interfaces_to_delete = copy.deepcopy(
self._interfaces_to_delete)
new_database._enums = copy.deepcopy(self._enums)
+ new_database._all_dictionaries = copy.deepcopy(self._all_dictionaries)
+
return new_database
def Delete(self):
@@ -245,6 +248,33 @@ class Database(object):
def AddEnum(self, enum):
self._enums[enum.id] = enum
+ def HasDictionary(self, dictionary_name):
+ """Returns True if the dictionary is in memory"""
+ return dictionary_name in self._all_dictionaries
+
+ def GetDictionary(self, dictionary_name):
+ """Returns an IDLDictionary corresponding to the dictionary_name
+ from memory.
+
+ Args:
+ dictionary_name -- the name of the dictionary.
+ """
+ if dictionary_name not in self._all_dictionaries:
+ raise RuntimeError('Dictionary %s is not loaded' % dictionary_name)
+ return self._all_dictionaries[dictionary_name]
+
+ def AddDictionary(self, dictionary):
+ """Returns an IDLDictionary corresponding to the dictionary_name
+ from memory.
+
+ Args:
+ dictionary -- the name of the dictionary.
+ """
+ dictionary_name = dictionary.id
+ if dictionary_name in self._all_dictionaries:
+ raise RuntimeError('Dictionary %s already exists' % dictionary_name)
+ self._all_dictionaries[dictionary_name] = dictionary
+
def TransitiveSecondaryParents(self, interface, propagate_event_target):
"""Returns a list of all non-primary parents.
« no previous file with comments | « tools/dom/scripts/dartmetadata.py ('k') | tools/dom/scripts/databasebuilder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698