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

Unified Diff: mojo/public/cpp/bindings/lib/pipe_control_message_handler.h

Issue 2064903002: Mojo: Report bindings validation errors via MojoNotifyBadMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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/pipe_control_message_handler.h
diff --git a/mojo/public/cpp/bindings/lib/pipe_control_message_handler.h b/mojo/public/cpp/bindings/lib/pipe_control_message_handler.h
index c42d0bae3d1e7ccd67062d858f1e321f56275087..f9cc1e3599efa037f6eb9c1ac1d8523ab780a187 100644
--- a/mojo/public/cpp/bindings/lib/pipe_control_message_handler.h
+++ b/mojo/public/cpp/bindings/lib/pipe_control_message_handler.h
@@ -5,6 +5,8 @@
#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_PIPE_CONTROL_MESSAGE_HANDLER_H_
#define MOJO_PUBLIC_CPP_BINDINGS_LIB_PIPE_CONTROL_MESSAGE_HANDLER_H_
+#include <string>
+
#include "base/macros.h"
#include "mojo/public/cpp/bindings/lib/interface_id.h"
#include "mojo/public/cpp/bindings/lib/serialization_context.h"
@@ -22,6 +24,9 @@ class PipeControlMessageHandler : public MessageReceiver {
PipeControlMessageHandlerDelegate* delegate);
~PipeControlMessageHandler() override;
+ // Sets the interface name for this handler. Used only for debugging info.
+ void set_interface_name(const std::string& name) { interface_name_ = name; }
+
// NOTE: |message| must have passed message header validation.
static bool IsPipeControlMessage(const Message* message);
@@ -31,15 +36,16 @@ class PipeControlMessageHandler : public MessageReceiver {
// - have passed message header validation; and
// - be a pipe control message (i.e., IsPipeControlMessage() returns true).
// If the method returns false, the message pipe should be closed.
- bool Accept(Message* message) override;
+ Result Accept(Message* message) override;
private:
// |message| must have passed message header validation.
- bool Validate(const Message* message);
+ Result Validate(Message* message);
bool RunOrClosePipe(Message* message);
PipeControlMessageHandlerDelegate* const delegate_;
SerializationContext context_;
+ std::string interface_name_;
DISALLOW_COPY_AND_ASSIGN(PipeControlMessageHandler);
};

Powered by Google App Engine
This is Rietveld 408576698