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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/data.py

Issue 535333002: Mojo: Make the mojom bindings generator not exponential in the import depth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/pylib/mojom/generate/data.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
index 98be283b0ae41d3b3fe9dfd9a06d567014c1cde1..52e2f7d7386d6844a5de08185e45d049dcdf803a 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
@@ -134,7 +134,12 @@ def KindFromData(kinds, data, scope):
def KindFromImport(original_kind, imported_from):
"""Used with 'import module' - clones the kind imported from the given
module's namespace. Only used with Structs, Interfaces and Enums."""
- kind = copy.deepcopy(original_kind)
+ kind = copy.copy(original_kind)
+ # |shared_definition| is used to store various properties (see
+ # |AddSharedProperty()| in module.py), including |imported_from|. We don't
+ # want the copy to share these with the original, so copy it if necessary.
+ if hasattr(original_kind, 'shared_definition'):
+ kind.shared_definition = copy.copy(original_kind.shared_definition)
kind.imported_from = imported_from
return kind
@@ -155,7 +160,9 @@ def ImportFromData(module, data):
# Ditto for values.
for value in import_module.values.itervalues():
if value.imported_from is None:
- value = copy.deepcopy(value)
+ # Values don't have shared definitions (since they're not nullable), so no
+ # need to do anything special.
+ value = copy.copy(value)
value.imported_from = import_item
module.values[value.GetSpec()] = value
« 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