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

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

Issue 2479693002: Roll third_party/inspector_protocol to 2952a8eb5d99fbc194946526b57d67ed52093699 (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 %}
213 virtual void sendFailure(const ErrorString&) = 0;
214 {% endif %}
215 }; 207 };
216 {% endif %} 208 {% endif %}
217 {%- if not("async" in command) and new_style(domain) %} 209 {%- if not("async" in command) %}
218 virtual DispatchResponse {{command.name}}( 210 virtual DispatchResponse {{command.name}}(
219 {%- else %} 211 {%- else %}
220 virtual void {{command.name}}( 212 virtual void {{command.name}}(
221 {%- endif %} 213 {%- endif %}
222 {%- if not("async" in command) and not new_style(domain) -%}
223 ErrorString*
224 {%- endif -%}
225 {%- for parameter in command.parameters -%} 214 {%- for parameter in command.parameters -%}
226 {%- if (not loop.first) or (not ("async" in command) and not new_style(dom ain)) -%}, {% endif -%} 215 {%- if not loop.first -%}, {% endif -%}
227 {%- if "optional" in parameter -%} 216 {%- if "optional" in parameter -%}
228 {%- if new_style(domain) -%}
229 Maybe<{{resolve_type(parameter).raw_type}}> in_{{parameter.name}} 217 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 -%} 218 {%- else -%}
234 {{resolve_type(parameter).pass_type}} in_{{parameter.name}} 219 {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
235 {%- endif -%} 220 {%- endif -%}
236 {%- endfor -%} 221 {%- endfor -%}
237 {%- if "async" in command -%} 222 {%- if "async" in command -%}
238 {%- if command.parameters -%}, {% endif -%} 223 {%- if command.parameters -%}, {% endif -%}
239 std::unique_ptr<{{command.name | to_title_case}}Callback> callback 224 std::unique_ptr<{{command.name | to_title_case}}Callback> callback
240 {%- else -%} 225 {%- else -%}
241 {%- for parameter in command.returns -%} 226 {%- for parameter in command.returns -%}
242 {%- if (not loop.first) or command.parameters or not new_style(domain) - %}, {% endif -%} 227 {%- if (not loop.first) or command.parameters -%}, {% endif -%}
243 {%- if "optional" in parameter -%} 228 {%- if "optional" in parameter -%}
244 Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}} 229 Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
245 {%- else -%} 230 {%- else -%}
246 {{resolve_type(parameter).type}}* out_{{parameter.name}} 231 {{resolve_type(parameter).type}}* out_{{parameter.name}}
247 {%- endif -%} 232 {%- endif -%}
248 {%- endfor -%} 233 {%- endfor -%}
249 {%- endif -%} 234 {%- endif -%}
250 ) = 0; 235 ) = 0;
251 {% endfor %} 236 {% endfor %}
252 237
253 {% if not has_disable(domain.commands) %} 238 {% if not has_disable(domain.commands) %}
254 {% if new_style(domain) %}
255 virtual DispatchResponse disable() 239 virtual DispatchResponse disable()
256 { 240 {
257 return DispatchResponse::OK(); 241 return DispatchResponse::OK();
258 } 242 }
259 {% else %}
260 virtual void disable(ErrorString*) { }
261 {% endif %}
262 {% endif %} 243 {% 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 }; 244 };
275 245
276 // ------------- Frontend interface. 246 // ------------- Frontend interface.
277 247
278 class {{config.protocol.export_macro}} Frontend { 248 class {{config.protocol.export_macro}} Frontend {
279 public: 249 public:
280 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann el) { } 250 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann el) { }
281 {% for event in domain.events %} 251 {% for event in domain.events %}
282 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %} 252 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %}
283 void {{event.name}}( 253 void {{event.name}}(
284 {%- for parameter in event.parameters -%} 254 {%- for parameter in event.parameters -%}
285 {%- if "optional" in parameter -%} 255 {%- if "optional" in parameter -%}
286 {%- if new_style(domain) -%}
287 Maybe<{{resolve_type(parameter).raw_type}}> {{parameter.name}} = Maybe<{ {resolve_type(parameter).raw_type}}>() 256 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 -%} 257 {%- else -%}
292 {{resolve_type(parameter).pass_type}} {{parameter.name}} 258 {{resolve_type(parameter).pass_type}} {{parameter.name}}
293 {%- endif -%}{%- if not loop.last -%}, {% endif -%} 259 {%- endif -%}{%- if not loop.last -%}, {% endif -%}
294 {%- endfor -%} 260 {%- endfor -%}
295 ); 261 );
296 {% endfor %} 262 {% endfor %}
297 263
298 void flush(); 264 void flush();
299 private: 265 private:
300 FrontendChannel* m_frontendChannel; 266 FrontendChannel* m_frontendChannel;
(...skipping 20 matching lines...) Expand all
321 static const char commandPrefix[]; 287 static const char commandPrefix[];
322 static const char version[]; 288 static const char version[];
323 }; 289 };
324 290
325 } // namespace {{domain.domain}} 291 } // namespace {{domain.domain}}
326 {% for namespace in config.protocol.namespace %} 292 {% for namespace in config.protocol.namespace %}
327 } // namespace {{namespace}} 293 } // namespace {{namespace}}
328 {% endfor %} 294 {% endfor %}
329 295
330 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) 296 #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