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

Unified Diff: third_party/inspector_protocol/templates/TypeBuilder_h.template

Issue 2463673004: [inspector_protocol] Support fall through. (Closed)
Patch Set: example domain converted Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/inspector_protocol/templates/TypeBuilder_cpp.template ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/inspector_protocol/templates/TypeBuilder_h.template
diff --git a/third_party/inspector_protocol/templates/TypeBuilder_h.template b/third_party/inspector_protocol/templates/TypeBuilder_h.template
index 553ba55f7c0de6956c1d0bf5900149a1a6c814b5..fa7688bf1242647bf5633f11c9fb2b1151d88403 100644
--- a/third_party/inspector_protocol/templates/TypeBuilder_h.template
+++ b/third_party/inspector_protocol/templates/TypeBuilder_h.template
@@ -191,41 +191,51 @@ public:
{% if "redirect" in command %}{% continue %}{% endif %}
{% if ("handlers" in command) and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %}
{% if "async" in command %}
- class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callback : public BackendCallback {
+ class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callback {
public:
virtual void sendSuccess(
- {%- for parameter in command.returns -%}
- {%- if "optional" in parameter -%}
+ {%- for parameter in command.returns -%}
+ {%- if "optional" in parameter -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}}
- {%- else -%}
+ {%- else -%}
{{resolve_type(parameter).pass_type}} {{parameter.name}}
- {%- endif -%}
- {%- if not loop.last -%}, {% endif -%}
- {%- endfor -%}
+ {%- endif -%}
+ {%- if not loop.last -%}, {% endif -%}
+ {%- endfor -%}
) = 0;
+ {% if new_style(domain) %}
+ virtual void sendFailure(const DispatchResponse&) = 0;
+ {% else %}
+ virtual void sendFailure(const ErrorString&) = 0;
+ {% endif %}
};
{% endif %}
+ {%- if not("async" in command) and new_style(domain) %}
+ virtual DispatchResponse {{command.name}}(
+ {%- else %}
virtual void {{command.name}}(
- {%- if not("async" in command) -%}
+ {%- endif %}
+ {%- if not("async" in command) and not new_style(domain) -%}
ErrorString*
{%- endif -%}
{%- for parameter in command.parameters -%}
- {%- if (not loop.first) or not("async" in command) -%}, {% endif -%}
- {%- if "optional" in parameter -%}
+ {%- if (not loop.first) or (not ("async" in command) and not new_style(domain)) -%}, {% endif -%}
+ {%- if "optional" in parameter -%}
const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name}}
- {%- else -%}
+ {%- else -%}
{{resolve_type(parameter).pass_type}} in_{{parameter.name}}
- {%- endif -%}
+ {%- endif -%}
{%- endfor -%}
{%- if "async" in command -%}
- {%- if command.parameters -%}, {% endif -%}
+ {%- if command.parameters -%}, {% endif -%}
std::unique_ptr<{{command.name | to_title_case}}Callback> callback
{%- else -%}
{%- for parameter in command.returns -%}
+ {%- if (not loop.first) or command.parameters or not new_style(domain) -%}, {% endif -%}
{%- if "optional" in parameter -%}
- , Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
+ Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
{%- else -%}
- , {{resolve_type(parameter).type}}* out_{{parameter.name}}
+ {{resolve_type(parameter).type}}* out_{{parameter.name}}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
@@ -233,8 +243,26 @@ public:
{% endfor %}
{% if not has_disable(domain.commands) %}
+ {% if new_style(domain) %}
+ virtual DispatchResponse disable()
+ {
+ return DispatchResponse::OK();
+ }
+ {% else %}
virtual void disable(ErrorString*) { }
+ {% endif %}
{% endif %}
+
+ // TODO(dgozman): remove once all domains migrated.
+ static void disableMe(Backend* backend)
+ {
+ {% if new_style(domain) %}
+ backend->disable();
+ {% else %}
+ ErrorString error;
+ backend->disable(&error);
+ {% endif %}
+ }
};
// ------------- Frontend interface.
« 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