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

Side by Side Diff: third_party/inspector_protocol/templates/TypeBuilder_h.template

Issue 2478853002: Roll third_party/inspector_protocol to ebda02bf94a742a2e26e4f818df1fc77517ac44c (Closed)
Patch Set: Created 4 years, 1 month 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 | « third_party/inspector_protocol/templates/TypeBuilder_cpp.template ('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 // This file is generated 1 // This file is generated
2 2
3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h
8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h
9 9
10 {% if config.protocol.export_header %} 10 {% if config.protocol.export_header %}
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 {% for command in domain.commands %} 190 {% for command in domain.commands %}
191 {% if "redirect" in command %}{% continue %}{% endif %} 191 {% if "redirect" in command %}{% continue %}{% endif %}
192 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %} 192 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %}
193 {% if "async" in command %} 193 {% if "async" in command %}
194 class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callb ack { 194 class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callb ack {
195 public: 195 public:
196 virtual void sendSuccess( 196 virtual void sendSuccess(
197 {%- for parameter in command.returns -%} 197 {%- for parameter in command.returns -%}
198 {%- if "optional" in parameter -%} 198 {%- if "optional" in parameter -%}
199 {%- if new_style(domain) -%}
200 Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} 199 Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}}
201 {%- else -%}
202 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name} }
203 {%- endif -%}
204 {%- else -%} 200 {%- else -%}
205 {{resolve_type(parameter).pass_type}} {{parameter.name}} 201 {{resolve_type(parameter).pass_type}} {{parameter.name}}
206 {%- endif -%} 202 {%- endif -%}
207 {%- if not loop.last -%}, {% endif -%} 203 {%- if not loop.last -%}, {% endif -%}
208 {%- endfor -%} 204 {%- endfor -%}
209 ) = 0; 205 ) = 0;
210 {% if new_style(domain) %}
211 virtual void sendFailure(const DispatchResponse&) = 0; 206 virtual void sendFailure(const DispatchResponse&) = 0;
212 {% else %} 207 virtual ~{{command.name | to_title_case}}Callback() { }
213 virtual void sendFailure(const ErrorString&) = 0;
214 {% endif %}
215 }; 208 };
216 {% endif %} 209 {% endif %}
217 {%- if not("async" in command) and new_style(domain) %} 210 {%- if not("async" in command) %}
218 virtual DispatchResponse {{command.name}}( 211 virtual DispatchResponse {{command.name}}(
219 {%- else %} 212 {%- else %}
220 virtual void {{command.name}}( 213 virtual void {{command.name}}(
221 {%- endif %} 214 {%- endif %}
222 {%- if not("async" in command) and not new_style(domain) -%}
223 ErrorString*
224 {%- endif -%}
225 {%- for parameter in command.parameters -%} 215 {%- for parameter in command.parameters -%}
226 {%- if (not loop.first) or (not ("async" in command) and not new_style(dom ain)) -%}, {% endif -%} 216 {%- if not loop.first -%}, {% endif -%}
227 {%- if "optional" in parameter -%} 217 {%- if "optional" in parameter -%}
228 {%- if new_style(domain) -%}
229 Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}} 218 Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}}
230 {%- else -%}
231 const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name}}
232 {%- endif -%}
233 {%- else -%} 219 {%- else -%}
234 {{resolve_type(parameter).pass_type}} in_{{parameter.name}} 220 {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
235 {%- endif -%} 221 {%- endif -%}
236 {%- endfor -%} 222 {%- endfor -%}
237 {%- if "async" in command -%} 223 {%- if "async" in command -%}
238 {%- if command.parameters -%}, {% endif -%} 224 {%- if command.parameters -%}, {% endif -%}
239 std::unique_ptr<{{command.name | to_title_case}}Callback> callback 225 std::unique_ptr<{{command.name | to_title_case}}Callback> callback
240 {%- else -%} 226 {%- else -%}
241 {%- for parameter in command.returns -%} 227 {%- for parameter in command.returns -%}
242 {%- if (not loop.first) or command.parameters or not new_style(domain) - %}, {% endif -%} 228 {%- if (not loop.first) or command.parameters -%}, {% endif -%}
243 {%- if "optional" in parameter -%} 229 {%- if "optional" in parameter -%}
244 Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}} 230 Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
245 {%- else -%} 231 {%- else -%}
246 {{resolve_type(parameter).type}}* out_{{parameter.name}} 232 {{resolve_type(parameter).type}}* out_{{parameter.name}}
247 {%- endif -%} 233 {%- endif -%}
248 {%- endfor -%} 234 {%- endfor -%}
249 {%- endif -%} 235 {%- endif -%}
250 ) = 0; 236 ) = 0;
251 {% endfor %} 237 {% endfor %}
252 238
253 {% if not has_disable(domain.commands) %} 239 {% if not has_disable(domain.commands) %}
254 {% if new_style(domain) %}
255 virtual DispatchResponse disable() 240 virtual DispatchResponse disable()
256 { 241 {
257 return DispatchResponse::OK(); 242 return DispatchResponse::OK();
258 } 243 }
259 {% else %}
260 virtual void disable(ErrorString*) { }
261 {% endif %}
262 {% endif %} 244 {% endif %}
263
264 // TODO(dgozman): remove once all domains migrated.
265 static void disableMe(Backend* backend)
266 {
267 {% if new_style(domain) %}
268 backend->disable();
269 {% else %}
270 ErrorString error;
271 backend->disable(&error);
272 {% endif %}
273 }
274 }; 245 };
275 246
276 // ------------- Frontend interface. 247 // ------------- Frontend interface.
277 248
278 class {{config.protocol.export_macro}} Frontend { 249 class {{config.protocol.export_macro}} Frontend {
279 public: 250 public:
280 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann el) { } 251 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann el) { }
281 {% for event in domain.events %} 252 {% for event in domain.events %}
282 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %} 253 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %}
283 void {{event.name}}( 254 void {{event.name}}(
284 {%- for parameter in event.parameters -%} 255 {%- for parameter in event.parameters -%}
285 {%- if "optional" in parameter -%} 256 {%- if "optional" in parameter -%}
286 {%- if new_style(domain) -%}
287 Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} = Maybe<{ {resolve_type(parameter).raw_type}}>() 257 Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} = Maybe<{ {resolve_type(parameter).raw_type}}>()
288 {%- else -%}
289 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}} = Maybe<{{resolve_type(parameter).raw_type}}>()
290 {%- endif -%}
291 {%- else -%} 258 {%- else -%}
292 {{resolve_type(parameter).pass_type}} {{parameter.name}} 259 {{resolve_type(parameter).pass_type}} {{parameter.name}}
293 {%- endif -%}{%- if not loop.last -%}, {% endif -%} 260 {%- endif -%}{%- if not loop.last -%}, {% endif -%}
294 {%- endfor -%} 261 {%- endfor -%}
295 ); 262 );
296 {% endfor %} 263 {% endfor %}
297 264
298 void flush(); 265 void flush();
299 private: 266 private:
300 FrontendChannel* m_frontendChannel; 267 FrontendChannel* m_frontendChannel;
(...skipping 20 matching lines...) Expand all
321 static const char commandPrefix[]; 288 static const char commandPrefix[];
322 static const char version[]; 289 static const char version[];
323 }; 290 };
324 291
325 } // namespace {{domain.domain}} 292 } // namespace {{domain.domain}}
326 {% for namespace in config.protocol.namespace %} 293 {% for namespace in config.protocol.namespace %}
327 } // namespace {{namespace}} 294 } // namespace {{namespace}}
328 {% endfor %} 295 {% endfor %}
329 296
330 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) 297 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h)
OLDNEW
« no previous file with comments | « third_party/inspector_protocol/templates/TypeBuilder_cpp.template ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698