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

Unified Diff: mojo/public/cpp/bindings/lib/interface_endpoint_client.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/interface_endpoint_client.h
diff --git a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h
index 3f820db3c30c66b179e6b2203478f66bb0b19509..5300026c46ec68964af1a1c7bbd3b3fb9726adf2 100644
--- a/mojo/public/cpp/bindings/lib/interface_endpoint_client.h
+++ b/mojo/public/cpp/bindings/lib/interface_endpoint_client.h
@@ -67,23 +67,28 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder {
AssociatedGroup* associated_group();
uint32_t interface_id() const;
+ void set_interface_name(const std::string& name) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ interface_name_ = name;
+ }
+
// After this call the object is in an invalid state and shouldn't be reused.
ScopedInterfaceEndpointHandle PassHandle();
// Raises an error on the underlying message pipe. It disconnects the pipe
// and notifies all interfaces running on this pipe.
- void RaiseError();
+ void RaiseError(Result error);
// MessageReceiverWithResponder implementation:
- bool Accept(Message* message) override;
- bool AcceptWithResponder(Message* message,
- MessageReceiver* responder) override;
+ Result Accept(Message* message) override;
+ Result AcceptWithResponder(Message* message,
+ MessageReceiver* responder) override;
// The following methods are called by the router. They must be called
// outside of the router's lock.
// NOTE: |message| must have passed message header validation.
- bool HandleIncomingMessage(Message* message);
+ Result HandleIncomingMessage(Message* message);
void NotifyError();
private:
@@ -116,7 +121,7 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder {
~HandleIncomingMessageThunk() override;
// MessageReceiver implementation:
- bool Accept(Message* message) override;
+ Result Accept(Message* message) override;
private:
InterfaceEndpointClient* const owner_;
@@ -124,7 +129,7 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder {
DISALLOW_COPY_AND_ASSIGN(HandleIncomingMessageThunk);
};
- bool HandleValidatedMessage(Message* message);
+ Result HandleValidatedMessage(Message* message);
ScopedInterfaceEndpointHandle handle_;
std::unique_ptr<AssociatedGroup> associated_group_;
@@ -142,6 +147,10 @@ class InterfaceEndpointClient : public MessageReceiverWithResponder {
Closure error_handler_;
bool encountered_error_;
+ // The name of the interface which is bound by this client. Used only for
+ // debugging purposes.
+ std::string interface_name_;
+
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::ThreadChecker thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698