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

Side by Side Diff: mojo/public/tools/bindings/generators/js_templates/struct_definition.tmpl

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed template indentation Created 6 years, 2 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
OLDNEW
1 {#--- Begin #} 1 {#--- Begin #}
2 function {{struct.name}}(values) { 2 function {{struct.name}}(values) {
3 this.initDefaults_(); 3 this.initDefaults_();
4 this.initFields_(values); 4 this.initFields_(values);
5 } 5 }
6 6
7 {#--- Enums #} 7 {#--- Enums #}
8 {%- from "enum_definition.tmpl" import enum_def %} 8 {%- from "enum_definition.tmpl" import enum_def %}
9 {% for enum in struct.enums %} 9 {% for enum in struct.enums %}
10 {{enum_def("%s.%s"|format(struct.name, enum.name), enum, module)}} 10 {{enum_def("%s.%s"|format(struct.name, enum.name), enum)}}
11 {%- endfor %} 11 {%- endfor %}
12 12
13 {#--- Constants #} 13 {#--- Constants #}
14 {% for constant in struct.constants %} 14 {% for constant in struct.constants %}
15 {{struct.name}}.{{constant.name}} = {{constant.value|expression_to_text}}; 15 {{struct.name}}.{{constant.name}} = {{constant.value|expression_to_text}};
16 {%- endfor %} 16 {%- endfor %}
17 17
18 {#--- initDefaults() #} 18 {#--- initDefaults() #}
19 {{struct.name}}.prototype.initDefaults_ = function() { 19 {{struct.name}}.prototype.initDefaults_ = function() {
20 {%- for packed_field in struct.packed.packed_fields %} 20 {%- for packed_field in struct.packed.packed_fields %}
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 {%- else %} 107 {%- else %}
108 {%- for packed_field in byte.packed_fields %} 108 {%- for packed_field in byte.packed_fields %}
109 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n ame}}); 109 encoder.{{packed_field.field.kind|encode_snippet}}val.{{packed_field.field.n ame}});
110 {%- endfor %} 110 {%- endfor %}
111 {%- endif %} 111 {%- endif %}
112 {%- if byte.is_padding %} 112 {%- if byte.is_padding %}
113 encoder.skip(1); 113 encoder.skip(1);
114 {%- endif %} 114 {%- endif %}
115 {%- endfor %} 115 {%- endfor %}
116 }; 116 };
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/js_templates/module.js.tmpl ('k') | ui/keyboard/resources/keyboard_mojo.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698