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

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

Issue 2563593005: Mojo JS bindings: lazily initialize the underlying connection of interface ptr. (Closed)
Patch Set: . Created 4 years 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 | « mojo/public/js/bindings.js ('k') | 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 {%- for method in interface.methods %} 1 {%- for method in interface.methods %}
2 var k{{interface.name}}_{{method.name}}_Name = {{method.ordinal}}; 2 var k{{interface.name}}_{{method.name}}_Name = {{method.ordinal}};
3 {%- endfor %} 3 {%- endfor %}
4 4
5 function {{interface.name}}Ptr() { 5 function {{interface.name}}Ptr() {
6 this.ptr = new bindings.InterfacePtrController({{interface.name}}); 6 this.ptr = new bindings.InterfacePtrController({{interface.name}});
7 } 7 }
8 8
9 function {{interface.name}}Proxy(receiver) { 9 function {{interface.name}}Proxy(receiver) {
10 bindings.ProxyBase.call(this, receiver); 10 bindings.ProxyBase.call(this, receiver);
11 } 11 }
12 {{interface.name}}Proxy.prototype = Object.create(bindings.ProxyBase.prototype ); 12 {{interface.name}}Proxy.prototype = Object.create(bindings.ProxyBase.prototype );
13 13
14 {%- for method in interface.methods %} 14 {%- for method in interface.methods %}
15 {{interface.name}}Ptr.prototype.{{method.name|stylize_method}} = function() { 15 {{interface.name}}Ptr.prototype.{{method.name|stylize_method}} = function() {
16 return {{interface.name}}Proxy.prototype.{{method.name|stylize_method}} 16 return {{interface.name}}Proxy.prototype.{{method.name|stylize_method}}
17 .apply(this.ptr.connection.remote, arguments); 17 .apply(this.ptr.getProxy(), arguments);
18 }; 18 };
19 19
20 {{interface.name}}Proxy.prototype.{{method.name|stylize_method}} = function( 20 {{interface.name}}Proxy.prototype.{{method.name|stylize_method}} = function(
21 {%- for parameter in method.parameters -%} 21 {%- for parameter in method.parameters -%}
22 {{parameter.name}}{% if not loop.last %}, {% endif %} 22 {{parameter.name}}{% if not loop.last %}, {% endif %}
23 {%- endfor -%} 23 {%- endfor -%}
24 ) { 24 ) {
25 var params = new {{interface.name}}_{{method.name}}_Params(); 25 var params = new {{interface.name}}_{{method.name}}_Params();
26 {%- for parameter in method.parameters %} 26 {%- for parameter in method.parameters %}
27 params.{{parameter.name}} = {{parameter|js_proxy_method_parameter_value}}; 27 params.{{parameter.name}} = {{parameter|js_proxy_method_parameter_value}};
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 {%- from "enum_definition.tmpl" import enum_def -%} 188 {%- from "enum_definition.tmpl" import enum_def -%}
189 {%- for enum in interface.enums %} 189 {%- for enum in interface.enums %}
190 {{ enum_def("%s.%s"|format(interface.name, enum.name), enum) }} 190 {{ enum_def("%s.%s"|format(interface.name, enum.name), enum) }}
191 {%- endfor %} 191 {%- endfor %}
192 {{interface.name}}Stub.prototype.validator = validate{{interface.name}}Request ; 192 {{interface.name}}Stub.prototype.validator = validate{{interface.name}}Request ;
193 {%- if interface|has_callbacks %} 193 {%- if interface|has_callbacks %}
194 {{interface.name}}Proxy.prototype.validator = validate{{interface.name}}Respon se; 194 {{interface.name}}Proxy.prototype.validator = validate{{interface.name}}Respon se;
195 {%- else %} 195 {%- else %}
196 {{interface.name}}Proxy.prototype.validator = null; 196 {{interface.name}}Proxy.prototype.validator = null;
197 {%- endif %} 197 {%- endif %}
OLDNEW
« no previous file with comments | « mojo/public/js/bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698