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

Side by Side Diff: mojo/public/bindings/generators/mojom_cpp_generator.py

Issue 66353002: Mojo: RemotePtr<S> + bindings changes for Peer attribute. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase + fix error in sample_service.h Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/bindings/generators/mojom.py ('k') | mojo/public/bindings/generators/mojom_data.py » ('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 (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 C++ source files from a mojom.Module.""" 5 """Generates C++ source files from a mojom.Module."""
6 6
7 import datetime 7 import datetime
8 import mojom 8 import mojom
9 import mojom_pack 9 import mojom_pack
10 import os 10 import os
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 methods = [] 304 methods = []
305 for method in interface.methods: 305 for method in interface.methods:
306 params = [] 306 params = []
307 for param in method.parameters: 307 for param in method.parameters:
308 params.append("%s %s" % (self.GetConstType(param.kind), param.name)) 308 params.append("%s %s" % (self.GetConstType(param.kind), param.name))
309 methods.append( 309 methods.append(
310 " virtual void %s(%s) %s;" % 310 " virtual void %s(%s) %s;" %
311 (method.name, ", ".join(params), method_postfix)) 311 (method.name, ", ".join(params), method_postfix))
312 return template.substitute( 312 return template.substitute(
313 CLASS=interface.name, 313 CLASS=interface.name,
314 METHODS='.\n'.join(methods)) 314 PEER=interface.peer,
315 METHODS='\n'.join(methods))
315 316
316 def GetInterfaceClassDeclarations(self): 317 def GetInterfaceClassDeclarations(self):
317 template = self.GetTemplate("interface_declaration") 318 template = self.GetTemplate("interface_declaration")
318 interface_decls = \ 319 interface_decls = \
319 map(lambda i: 320 map(lambda i:
320 self.GetInterfaceClassDeclaration(i, template, " = 0"), 321 self.GetInterfaceClassDeclaration(i, template, " = 0"),
321 self.module.interfaces) 322 self.module.interfaces)
322 return '\n'.join(interface_decls) 323 return '\n'.join(interface_decls)
323 324
324 def GetInterfaceProxyDeclarations(self): 325 def GetInterfaceProxyDeclarations(self):
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 self.module.structs); 475 self.module.structs);
475 self.WriteTemplateToFile("module_internal.h", 476 self.WriteTemplateToFile("module_internal.h",
476 HEADER_GUARD = self.GetHeaderGuard(self.module.name + "_INTERNAL"), 477 HEADER_GUARD = self.GetHeaderGuard(self.module.name + "_INTERNAL"),
477 HEADER = self.GetHeaderFile(self.module.name), 478 HEADER = self.GetHeaderFile(self.module.name),
478 TRAITS = '\n'.join(traits)) 479 TRAITS = '\n'.join(traits))
479 480
480 def GenerateFiles(self): 481 def GenerateFiles(self):
481 self.GenerateModuleHeader() 482 self.GenerateModuleHeader()
482 self.GenerateModuleInternalHeader() 483 self.GenerateModuleInternalHeader()
483 self.GenerateModuleSource() 484 self.GenerateModuleSource()
OLDNEW
« no previous file with comments | « mojo/public/bindings/generators/mojom.py ('k') | mojo/public/bindings/generators/mojom_data.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698