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

Unified Diff: mojo/public/cpp/bindings/lib/control_message_handler.cc

Issue 2766523002: mojo: MessageReceiver*::AcceptWithResponder() now take a unique_ptr to the responder (Closed)
Patch Set: comments Created 3 years, 9 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
Index: mojo/public/cpp/bindings/lib/control_message_handler.cc
diff --git a/mojo/public/cpp/bindings/lib/control_message_handler.cc b/mojo/public/cpp/bindings/lib/control_message_handler.cc
index c90aadadd43f7436248f134575ca6e1a1289e0d8..1b7bb78e5fc6173d503fcd37e1b789061d65a3f5 100644
--- a/mojo/public/cpp/bindings/lib/control_message_handler.cc
+++ b/mojo/public/cpp/bindings/lib/control_message_handler.cc
@@ -9,6 +9,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/macros.h"
#include "mojo/public/cpp/bindings/lib/message_builder.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
@@ -80,19 +81,20 @@ bool ControlMessageHandler::Accept(Message* message) {
bool ControlMessageHandler::AcceptWithResponder(
Message* message,
- MessageReceiverWithStatus* responder) {
+ std::unique_ptr<MessageReceiverWithStatus> responder) {
if (!ValidateControlRequestWithResponse(message))
return false;
if (message->header()->name == interface_control::kRunMessageId)
- return Run(message, responder);
+ return Run(message, std::move(responder));
NOTREACHED();
return false;
}
-bool ControlMessageHandler::Run(Message* message,
- MessageReceiverWithStatus* responder) {
+bool ControlMessageHandler::Run(
+ Message* message,
+ std::unique_ptr<MessageReceiverWithStatus> responder) {
interface_control::internal::RunMessageParams_Data* params =
reinterpret_cast<interface_control::internal::RunMessageParams_Data*>(
message->mutable_payload());
@@ -124,9 +126,7 @@ bool ControlMessageHandler::Run(Message* message,
nullptr;
Serialize<interface_control::RunResponseMessageParamsDataView>(
response_params_ptr, builder.buffer(), &response_params, &context_);
- bool ok = responder->Accept(builder.message());
- ALLOW_UNUSED_LOCAL(ok);
- delete responder;
+ ignore_result(responder->Accept(builder.message()));
return true;
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/control_message_handler.h ('k') | mojo/public/cpp/bindings/lib/control_message_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698