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

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

Issue 10021024: DOM libraries generation should not fail when database cache don't exist. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/database.py
diff --git a/lib/dom/scripts/database.py b/lib/dom/scripts/database.py
index 44be932a819d97aebb2abf791bffde7213e1f9be..4c9ef0947e6c94581031c649d1f91ad0d4a79e96 100755
--- a/lib/dom/scripts/database.py
+++ b/lib/dom/scripts/database.py
@@ -132,9 +132,14 @@ class Database(object):
def LoadFromCache(self):
"""Deserialize the database using pickle for fast startup
"""
- input_file = open(os.path.join(self._root_dir, 'cache.pickle'), 'rb')
+ input_file_name = os.path.join(self._root_dir, 'cache.pickle')
+ if not os.path.isfile(input_file_name):
+ self.Load()
+ return
+ input_file = open(input_file_name, 'rb')
self._all_interfaces = pickle.load(input_file)
self._interfaces_to_delete = pickle.load(input_file)
+ input_file.close()
def Save(self):
"""Saves all in-memory interfaces into files."""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698