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

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

Issue 2202893002: Mojo C++ Bindings: Add helpers for bad message reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « mojo/public/interfaces/bindings/tests/test_bad_messages.mojom ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
index 8fc01dc3263899057ac4248648e761dca3c25a1e..8a8c6f9bb65493bc5e3a1eb2c4f74a1cfd36609f 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -104,6 +104,8 @@ bool {{class_name}}_{{method.name}}_HandleSyncResponse::Accept(
{%- for param in method.response_parameters %}
*out_{{param.name}}_ = std::move(p_{{param.name}});
{%- endfor %}
+ mojo::internal::SyncMessageResponseSetup::SetCurrentSyncResponseMessage(
+ message);
*result_ = true;
return true;
}
@@ -133,8 +135,10 @@ bool {{class_name}}_{{method.name}}_ForwardToCallback::Accept(
{%- set desc = class_name~"::"~method.name~" response" %}
{{alloc_params(method.response_param_struct, "params", "message",
"&serialization_context_", desc)}}
- if (!callback_.is_null())
+ if (!callback_.is_null()) {
+ mojo::internal::MessageDispatchContext context(message);
callback_.Run({{pass_params(method.response_parameters)}});
+ }
return true;
}
{%- endif %}
@@ -318,6 +322,7 @@ bool {{class_name}}Stub::Accept(mojo::Message* message) {
// A null |sink_| means no implementation was bound.
assert(sink_);
TRACE_EVENT0("mojom", "{{class_name}}::{{method.name}}");
+ mojo::internal::MessageDispatchContext context(message);
sink_->{{method.name}}({{pass_params(method.parameters)}});
return true;
{%- else %}
@@ -356,6 +361,7 @@ bool {{class_name}}Stub::AcceptWithResponder(
// A null |sink_| means no implementation was bound.
assert(sink_);
TRACE_EVENT0("mojom", "{{class_name}}::{{method.name}}");
+ mojo::internal::MessageDispatchContext context(message);
sink_->{{method.name}}(
{%- if method.parameters -%}{{pass_params(method.parameters)}}, {% endif -%}callback);
return true;
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_bad_messages.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698