OLD | NEW |
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 C++ source files from a mojom.Module.""" | 5 """Generates C++ 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 374 |
375 @UseJinja("module-shared-internal.h.tmpl") | 375 @UseJinja("module-shared-internal.h.tmpl") |
376 def _GenerateModuleSharedInternalHeader(self): | 376 def _GenerateModuleSharedInternalHeader(self): |
377 return self._GetJinjaExports() | 377 return self._GetJinjaExports() |
378 | 378 |
379 @UseJinja("module-shared.cc.tmpl") | 379 @UseJinja("module-shared.cc.tmpl") |
380 def _GenerateModuleSharedSource(self): | 380 def _GenerateModuleSharedSource(self): |
381 return self._GetJinjaExports() | 381 return self._GetJinjaExports() |
382 | 382 |
383 def GenerateFiles(self, args): | 383 def GenerateFiles(self, args): |
| 384 self.module.Stylize(generator.Stylizer()) |
| 385 |
384 if self.generate_non_variant_code: | 386 if self.generate_non_variant_code: |
385 self.Write(self._GenerateModuleSharedHeader(), | 387 self.Write(self._GenerateModuleSharedHeader(), |
386 self.MatchMojomFilePath("%s-shared.h" % self.module.name)) | 388 self.MatchMojomFilePath("%s-shared.h" % self.module.name)) |
387 self.Write( | 389 self.Write( |
388 self._GenerateModuleSharedInternalHeader(), | 390 self._GenerateModuleSharedInternalHeader(), |
389 self.MatchMojomFilePath("%s-shared-internal.h" % self.module.name)) | 391 self.MatchMojomFilePath("%s-shared-internal.h" % self.module.name)) |
390 self.Write(self._GenerateModuleSharedSource(), | 392 self.Write(self._GenerateModuleSharedSource(), |
391 self.MatchMojomFilePath("%s-shared.cc" % self.module.name)) | 393 self.MatchMojomFilePath("%s-shared.cc" % self.module.name)) |
392 else: | 394 else: |
393 suffix = "-%s" % self.variant if self.variant else "" | 395 suffix = "-%s" % self.variant if self.variant else "" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 if mojom.IsDataPipeProducerKind(kind): | 797 if mojom.IsDataPipeProducerKind(kind): |
796 return "mojo::ScopedDataPipeProducerHandle" | 798 return "mojo::ScopedDataPipeProducerHandle" |
797 if mojom.IsMessagePipeKind(kind): | 799 if mojom.IsMessagePipeKind(kind): |
798 return "mojo::ScopedMessagePipeHandle" | 800 return "mojo::ScopedMessagePipeHandle" |
799 if mojom.IsSharedBufferKind(kind): | 801 if mojom.IsSharedBufferKind(kind): |
800 return "mojo::ScopedSharedBufferHandle" | 802 return "mojo::ScopedSharedBufferHandle" |
801 return _kind_to_cpp_type[kind] | 803 return _kind_to_cpp_type[kind] |
802 | 804 |
803 def _GetUnmappedTypeForSerializer(self, kind): | 805 def _GetUnmappedTypeForSerializer(self, kind): |
804 return self._GetCppDataViewType(kind, qualified=True) | 806 return self._GetCppDataViewType(kind, qualified=True) |
OLD | NEW |