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

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

Issue 68893032: Mojo: generated pointer 'getters' should return const pointers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | no next file » | 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 " payload_size += mojo::internal::ComputeSizeOf($NAME);") 77 " payload_size += mojo::internal::ComputeSizeOf($NAME);")
78 field_template = Template(" $TYPE ${FIELD}_;") 78 field_template = Template(" $TYPE ${FIELD}_;")
79 bool_field_template = Template(" uint8_t ${FIELD}_ : 1;") 79 bool_field_template = Template(" uint8_t ${FIELD}_ : 1;")
80 setter_template = \ 80 setter_template = \
81 Template(" void set_$FIELD($TYPE $FIELD) { ${FIELD}_ = $FIELD; }") 81 Template(" void set_$FIELD($TYPE $FIELD) { ${FIELD}_ = $FIELD; }")
82 ptr_setter_template = \ 82 ptr_setter_template = \
83 Template(" void set_$FIELD($TYPE $FIELD) { ${FIELD}_.ptr = $FIELD; }") 83 Template(" void set_$FIELD($TYPE $FIELD) { ${FIELD}_.ptr = $FIELD; }")
84 getter_template = \ 84 getter_template = \
85 Template(" $TYPE $FIELD() const { return ${FIELD}_; }") 85 Template(" $TYPE $FIELD() const { return ${FIELD}_; }")
86 ptr_getter_template = \ 86 ptr_getter_template = \
87 Template(" $TYPE $FIELD() const { return ${FIELD}_.ptr; }") 87 Template(" const $TYPE $FIELD() const { return ${FIELD}_.ptr; }")
88 pad_template = Template(" uint8_t _pad${COUNT}_[$PAD];") 88 pad_template = Template(" uint8_t _pad${COUNT}_[$PAD];")
89 templates = {} 89 templates = {}
90 HEADER_SIZE = 8 90 HEADER_SIZE = 8
91 91
92 kind_to_type = { 92 kind_to_type = {
93 mojom.BOOL: "bool", 93 mojom.BOOL: "bool",
94 mojom.INT8: "int8_t", 94 mojom.INT8: "int8_t",
95 mojom.UINT8: "uint8_t", 95 mojom.UINT8: "uint8_t",
96 mojom.INT16: "int16_t", 96 mojom.INT16: "int16_t",
97 mojom.UINT16: "uint16_t", 97 mojom.UINT16: "uint16_t",
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 self.module.structs); 475 self.module.structs);
476 self.WriteTemplateToFile("module_internal.h", 476 self.WriteTemplateToFile("module_internal.h",
477 HEADER_GUARD = self.GetHeaderGuard(self.module.name + "_INTERNAL"), 477 HEADER_GUARD = self.GetHeaderGuard(self.module.name + "_INTERNAL"),
478 HEADER = self.GetHeaderFile(self.module.name), 478 HEADER = self.GetHeaderFile(self.module.name),
479 TRAITS = '\n'.join(traits)) 479 TRAITS = '\n'.join(traits))
480 480
481 def GenerateFiles(self): 481 def GenerateFiles(self):
482 self.GenerateModuleHeader() 482 self.GenerateModuleHeader()
483 self.GenerateModuleInternalHeader() 483 self.GenerateModuleInternalHeader()
484 self.GenerateModuleSource() 484 self.GenerateModuleSource()
OLDNEW
« 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