| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 {% import "struct.tmpl" as struct_macros %} | 5 {% import "struct.tmpl" as struct_macros %} |
| 6 | 6 |
| 7 {%- macro declare_params(struct) %} | 7 {%- macro declare_params(struct) %} |
| 8 {%- for field in struct.fields -%} | 8 {%- for field in struct.fields -%} |
| 9 {{field|name(False)}} {{field.kind|go_type}}{% if not loop.last %}, {% e
ndif %} | 9 {{field|name(False)}} {{field.kind|go_type}}{% if not loop.last %}, {% e
ndif %} |
| 10 {%- endfor %} | 10 {%- endfor %} |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 {% macro define(interface) %} | 38 {% macro define(interface) %} |
| 39 type {{interface|name}} interface { | 39 type {{interface|name}} interface { |
| 40 {% for method in interface.methods %} | 40 {% for method in interface.methods %} |
| 41 {{method|name}}{{declare_request_params(method)}} | 41 {{method|name}}{{declare_request_params(method)}} |
| 42 {% endfor %} | 42 {% endfor %} |
| 43 } | 43 } |
| 44 | 44 |
| 45 type {{interface|name}}Request bindings.InterfaceRequest | 45 type {{interface|name}}Request bindings.InterfaceRequest |
| 46 type {{interface|name}}Pointer bindings.InterfacePointer | 46 type {{interface|name}}Pointer bindings.InterfacePointer |
| 47 | 47 |
| 48 // CreateMessagePipeFor{{interface|name}} creates a message pipe for use with th
e |
| 49 // {{interface|name}} interface with a {{interface|name}}Request on one end and
a {{interface|name}}Pointer on the other. |
| 50 func CreateMessagePipeFor{{interface|name}}() ({{interface|name}}Request, {{inte
rface|name}}Pointer) { |
| 51 r, p := bindings.CreateMessagePipeForMojoInterface() |
| 52 return {{interface|name}}Request(r), {{interface|name}}Pointer(p) |
| 53 } |
| 54 |
| 48 {% for method in interface.methods %} | 55 {% for method in interface.methods %} |
| 49 const {{interface|name(False)}}_{{method|name}}_Name = {{method.ordinal}} | 56 const {{interface|name(False)}}_{{method|name}}_Name = {{method.ordinal}} |
| 50 {% endfor %} | 57 {% endfor %} |
| 51 | 58 |
| 52 type {{interface|name}}Proxy struct { | 59 type {{interface|name}}Proxy struct { |
| 53 router *bindings.Router | 60 router *bindings.Router |
| 54 ids *bindings.Counter | 61 ids *bindings.Counter |
| 55 } | 62 } |
| 56 | 63 |
| 57 func New{{interface|name}}Proxy(p {{interface|name}}Pointer, waiter bindings.Asy
ncWaiter) *{{interface|name}}Proxy { | 64 func New{{interface|name}}Proxy(p {{interface|name}}Pointer, waiter bindings.Asy
ncWaiter) *{{interface|name}}Proxy { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return s.connector.WriteMessage(message) | 163 return s.connector.WriteMessage(message) |
| 157 {% endif %} | 164 {% endif %} |
| 158 {% endfor %} | 165 {% endfor %} |
| 159 default: | 166 default: |
| 160 return fmt.Errorf("unsupported request type %v", message.Header.
Type); | 167 return fmt.Errorf("unsupported request type %v", message.Header.
Type); |
| 161 } | 168 } |
| 162 return | 169 return |
| 163 } | 170 } |
| 164 | 171 |
| 165 {% endmacro %} | 172 {% endmacro %} |
| OLD | NEW |