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

Side by Side Diff: mojo/public/tools/bindings/generators/mojom_js_generator.py

Issue 845103004: Mojo JS Bindings: add show_image example (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « examples/js/show_image.js ('k') | sky/tools/debugger/debugger.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generates JavaScript source files from a mojom.Module.""" 5 """Generates JavaScript source files from a mojom.Module."""
6 6
7 import mojom.generate.generator as generator 7 import mojom.generate.generator as generator
8 import mojom.generate.module as mojom 8 import mojom.generate.module as mojom
9 import mojom.generate.pack as pack 9 import mojom.generate.pack as pack
10 from mojom.generate.template_expander import UseJinja 10 from mojom.generate.template_expander import UseJinja
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 # Since each import is assigned a variable in JS, they need to have unique 360 # Since each import is assigned a variable in JS, they need to have unique
361 # names. 361 # names.
362 unique_name = simple_name 362 unique_name = simple_name
363 counter = 0 363 counter = 0
364 while unique_name in used_names: 364 while unique_name in used_names:
365 counter += 1 365 counter += 1
366 unique_name = simple_name + str(counter) 366 unique_name = simple_name + str(counter)
367 367
368 used_names.add(unique_name) 368 used_names.add(unique_name)
369 each_import["unique_name"] = unique_name 369 each_import["unique_name"] = unique_name + "$"
370 counter += 1 370 counter += 1
371 return self.module.imports 371 return self.module.imports
372 372
373 def GetImportedInterfaces(self): 373 def GetImportedInterfaces(self):
374 interface_to_import = {}; 374 interface_to_import = {};
375 for each_import in self.module.imports: 375 for each_import in self.module.imports:
376 for each_interface in each_import["module"].interfaces: 376 for each_interface in each_import["module"].interfaces:
377 name = each_interface.name 377 name = each_interface.name
378 interface_to_import[name] = each_import["unique_name"] + "." + name 378 interface_to_import[name] = each_import["unique_name"] + "." + name
379 return interface_to_import; 379 return interface_to_import;
380 380
OLDNEW
« no previous file with comments | « examples/js/show_image.js ('k') | sky/tools/debugger/debugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698