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

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: put interface control methods in the |ptr| property 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..c479a8b3e4a195746de0ebae997c747b154bbb68 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,21 @@
var k{{interface.name}}_{{method.name}}_Name = {{method.ordinal}};
{%- endfor %}
+ function {{interface.name}}Ptr() {
+ this.ptr = new bindings.InterfacePtrController({{interface.name}});
+ }
+
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.ptr.connection.remote, arguments);
+ };
+
{{interface.name}}Proxy.prototype.{{method.name|stylize_method}} = function(
{%- for parameter in method.parameters -%}
{{parameter.name}}{% if not loop.last %}, {% endif %}
« no previous file with comments | « mojo/public/js/connection.js ('k') | mojo/public/tools/bindings/generators/js_templates/module_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698