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

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

Issue 226243003: Mojo: Get rid of some EOL whitespace in C++ .tmpl files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {%- import "interface_macros.tmpl" as interface_macros %} 1 {%- import "interface_macros.tmpl" as interface_macros %}
2 {%- set class_name = interface.name %} 2 {%- set class_name = interface.name %}
3 {%- set proxy_name = interface.name ~ "Proxy" %} 3 {%- set proxy_name = interface.name ~ "Proxy" %}
4 4
5 {%- macro pass_params(parameters) %} 5 {%- macro pass_params(parameters) %}
6 {%- for param in parameters %} 6 {%- for param in parameters %}
7 {%- if param.kind|is_object_kind -%} 7 {%- if param.kind|is_object_kind -%}
8 mojo::internal::Wrap(params->{{param.name}}()) 8 mojo::internal::Wrap(params->{{param.name}}())
9 {%- elif param.kind|is_handle_kind -%} 9 {%- elif param.kind|is_handle_kind -%}
10 mojo::MakePassable(params->{{param.name}}()).Pass() 10 mojo::MakePassable(params->{{param.name}}()).Pass()
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 : callback_(callback) { 60 : callback_(callback) {
61 } 61 }
62 virtual bool Accept(mojo::Message* message) MOJO_OVERRIDE; 62 virtual bool Accept(mojo::Message* message) MOJO_OVERRIDE;
63 virtual bool AcceptWithResponder( 63 virtual bool AcceptWithResponder(
64 mojo::Message* message, 64 mojo::Message* message,
65 mojo::MessageReceiver* responder) MOJO_OVERRIDE { 65 mojo::MessageReceiver* responder) MOJO_OVERRIDE {
66 assert(false); 66 assert(false);
67 return false; 67 return false;
68 } 68 }
69 private: 69 private:
70 {{interface_macros.declare_callback(method)}} callback_; 70 {{interface_macros.declare_callback(method)}} callback_;
71 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ForwardToCallback ); 71 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ForwardToCallback );
72 }; 72 };
73 bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept( 73 bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept(
74 mojo::Message* message) { 74 mojo::Message* message) {
75 internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params = 75 internal::{{class_name}}_{{method.name}}_ResponseParams_Data* params =
76 reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_D ata*>( 76 reinterpret_cast<internal::{{class_name}}_{{method.name}}_ResponseParams_D ata*>(
77 message->mutable_payload()); 77 message->mutable_payload());
78 78
79 if (!params->DecodePointersAndHandles(message)) 79 if (!params->DecodePointersAndHandles(message))
80 return false; 80 return false;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 virtual void Run({{interface_macros.declare_params(method.response_parameters) }}) const; 143 virtual void Run({{interface_macros.declare_params(method.response_parameters) }}) const;
144 144
145 private: 145 private:
146 uint64_t request_id_; 146 uint64_t request_id_;
147 mutable mojo::MessageReceiver* responder_; 147 mutable mojo::MessageReceiver* responder_;
148 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder) ; 148 MOJO_DISALLOW_COPY_AND_ASSIGN({{class_name}}_{{method.name}}_ProxyToResponder) ;
149 }; 149 };
150 void {{class_name}}_{{method.name}}_ProxyToResponder::Run( 150 void {{class_name}}_{{method.name}}_ProxyToResponder::Run(
151 {{interface_macros.declare_params(method.response_parameters)}}) const { 151 {{interface_macros.declare_params(method.response_parameters)}}) const {
152 {{compute_payload_size(params_name, method.response_parameters)}} 152 {{compute_payload_size(params_name, method.response_parameters)}}
153 mojo::internal::ResponseMessageBuilder builder( 153 mojo::internal::ResponseMessageBuilder builder(
154 {{message_name}}, payload_size, request_id_); 154 {{message_name}}, payload_size, request_id_);
155 {{build_message(params_name, method.response_parameters)}} 155 {{build_message(params_name, method.response_parameters)}}
156 responder_->Accept(&message); 156 responder_->Accept(&message);
157 delete responder_; 157 delete responder_;
158 responder_ = NULL; 158 responder_ = NULL;
159 } 159 }
160 {%- endif -%} 160 {%- endif -%}
161 {%- endfor %} 161 {%- endfor %}
162 162
163 {{class_name}}Stub::{{class_name}}Stub({{class_name}}* sink) 163 {{class_name}}Stub::{{class_name}}Stub({{class_name}}* sink)
164 : sink_(sink) { 164 : sink_(sink) {
165 } 165 }
166 166
167 {#--- Stub definition #} 167 {#--- Stub definition #}
168 168
169 bool {{class_name}}Stub::Accept(mojo::Message* message) { 169 bool {{class_name}}Stub::Accept(mojo::Message* message) {
170 {%- if interface.methods %} 170 {%- if interface.methods %}
171 switch (message->header()->name) { 171 switch (message->header()->name) {
172 {%- for method in interface.methods %} 172 {%- for method in interface.methods %}
173 case internal::k{{class_name}}_{{method.name}}_Name: { 173 case internal::k{{class_name}}_{{method.name}}_Name: {
174 {%- if method.response_parameters == None %} 174 {%- if method.response_parameters == None %}
175 internal::{{class_name}}_{{method.name}}_Params_Data* params = 175 internal::{{class_name}}_{{method.name}}_Params_Data* params =
176 reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data* >( 176 reinterpret_cast<internal::{{class_name}}_{{method.name}}_Params_Data* >(
177 message->mutable_payload()); 177 message->mutable_payload());
178 178
179 if (!params->DecodePointersAndHandles(message)) 179 if (!params->DecodePointersAndHandles(message))
180 return false; 180 return false;
181 sink_->{{method.name}}({{pass_params(method.parameters)}}); 181 sink_->{{method.name}}({{pass_params(method.parameters)}});
182 params->CloseHandles(); 182 params->CloseHandles();
183 return true; 183 return true;
184 {%- else %} 184 {%- else %}
185 break; 185 break;
186 {%- endif %} 186 {%- endif %}
187 } 187 }
188 {%- endfor %} 188 {%- endfor %}
189 } 189 }
190 {%- endif %} 190 {%- endif %}
191 return false; 191 return false;
192 } 192 }
193 193
194 bool {{class_name}}Stub::AcceptWithResponder( 194 bool {{class_name}}Stub::AcceptWithResponder(
195 mojo::Message* message, mojo::MessageReceiver* responder) { 195 mojo::Message* message, mojo::MessageReceiver* responder) {
196 {%- if interface.methods %} 196 {%- if interface.methods %}
(...skipping 10 matching lines...) Expand all
207 {{interface_macros.declare_callback(method)}}::Runnable* runnable = 207 {{interface_macros.declare_callback(method)}}::Runnable* runnable =
208 new {{class_name}}_{{method.name}}_ProxyToResponder( 208 new {{class_name}}_{{method.name}}_ProxyToResponder(
209 message->request_id(), responder); 209 message->request_id(), responder);
210 {{interface_macros.declare_callback(method)}} callback(runnable); 210 {{interface_macros.declare_callback(method)}} callback(runnable);
211 sink_->{{method.name}}( 211 sink_->{{method.name}}(
212 {%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}call back); 212 {%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}call back);
213 params->CloseHandles(); 213 params->CloseHandles();
214 return true; 214 return true;
215 {%- else %} 215 {%- else %}
216 break; 216 break;
217 {%- endif %} 217 {%- endif %}
218 } 218 }
219 {%- endfor %} 219 {%- endfor %}
220 } 220 }
221 {%- endif %} 221 {%- endif %}
222 return false; 222 return false;
223 } 223 }
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/generators/cpp_templates/interface_stub_declaration.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698