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

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

Issue 267803008: Mojo: Force folks to handle the return value of MessageReceiver::Accept{WithResponder} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/message.h ('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 4910463d805d53a75cc3b26767508d19313ba18a..7a030238623cef01e45cf74dab417ea83c6cbb3a 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -114,7 +114,9 @@ void {{proxy_name}}::{{method.name}}(
if (!receiver_->AcceptWithResponder(&message, responder))
delete responder;
{%- else %}
- receiver_->Accept(&message);
+ bool ok MOJO_ALLOW_UNUSED = receiver_->Accept(&message);
+ // This return value may be ignored as !ok implies the Connector has
+ // encountered an error, which will be visible through other means.
{%- endif %}
}
{%- endfor %}
@@ -153,7 +155,10 @@ void {{class_name}}_{{method.name}}_ProxyToResponder::Run(
mojo::internal::ResponseMessageBuilder builder(
{{message_name}}, payload_size, request_id_);
{{build_message(params_name, method.response_parameters)}}
- responder_->Accept(&message);
+ bool ok MOJO_ALLOW_UNUSED = responder_->Accept(&message);
+ // TODO(darin): !ok returned here indicates a malformed message, and that may
+ // be good reason to close the connection. However, we don't have a way to do
+ // that from here. We should add a way.
delete responder_;
responder_ = NULL;
}
« no previous file with comments | « mojo/public/cpp/bindings/message.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698