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

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

Issue 2549683002: Mojo JS bindings: introduce concepts that are more similar to C++ bindings: (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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
index 1b5cafa01e4501e67a3e9694bdb55d818a98513e..9ae211659b890555de2057ac2a635110792fa2ff 100644
--- a/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/js_templates/interface_definition.tmpl
@@ -2,12 +2,23 @@
var k{{interface.name}}_{{method.name}}_Name = {{method.ordinal}};
{%- endfor %}
+ function {{interface.name}}Ptr() {
yzshen1 2016/12/02 00:22:59 As you can see, I decided to create FooPtr which i
+ bindings.InterfacePtrBase.call(this, {{interface.name}});
+ }
+ {{interface.name}}Ptr.prototype =
+ Object.create(bindings.InterfacePtrBase.prototype);
+
function {{interface.name}}Proxy(receiver) {
bindings.ProxyBase.call(this, receiver);
}
{{interface.name}}Proxy.prototype = Object.create(bindings.ProxyBase.prototype);
{%- for method in interface.methods %}
+ {{interface.name}}Ptr.prototype.{{method.name|stylize_method}} = function() {
+ return {{interface.name}}Proxy.prototype.{{method.name|stylize_method}}
+ .apply(this.connection.remote, arguments);
+ };
+
{{interface.name}}Proxy.prototype.{{method.name|stylize_method}} = function(
{%- for parameter in method.parameters -%}
{{parameter.name}}{% if not loop.last %}, {% endif %}

Powered by Google App Engine
This is Rietveld 408576698