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

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

Issue 273233002: Mojo cpp bindings: add support for validating incoming messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto the InterfacePtr change Created 6 years, 7 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_ptr_internal.h
diff --git a/mojo/public/cpp/bindings/lib/interface_ptr_internal.h b/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
index 041a31c8a0c8134058705775019069d19f924f6c..181706fc5dbbd9967155cfc86a2e7557e4f453ae 100644
--- a/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
+++ b/mojo/public/cpp/bindings/lib/interface_ptr_internal.h
@@ -7,7 +7,9 @@
#include <stdio.h>
+#include "mojo/public/cpp/bindings/lib/message_header_validator.h"
#include "mojo/public/cpp/bindings/lib/router.h"
+#include "mojo/public/cpp/bindings/lib/validator_chain.h"
namespace mojo {
namespace internal {
@@ -47,7 +49,12 @@ class InterfacePtrState {
assert(!instance_);
assert(!router_);
- router_ = new Router(handle.Pass(), waiter);
+ internal::ValidatorChain validators;
darin (slow to review) 2014/05/12 17:28:26 nit: already in the internal namespace
yzshen1 2014/05/12 21:59:58 Done.
+ validators.Append(new internal::MessageHeaderValidator)
+ .Append(new typename Interface::Client_::RequestValidator_)
+ .Append(new typename Interface::ResponseValidator_);
+
+ router_ = new Router(handle.Pass(), validators.Pass(), waiter);
ProxyWithStub* proxy = new ProxyWithStub(router_);
router_->set_incoming_receiver(&proxy->stub);
@@ -62,7 +69,12 @@ class InterfacePtrState {
// Stub for binding to state_.instance
// Proxy for communicating to the client on the other end of the pipe.
- router_ = new Router(handle.Pass(), waiter);
+ internal::ValidatorChain validators;
+ validators.Append(new internal::MessageHeaderValidator)
+ .Append(new typename Interface::RequestValidator_)
+ .Append(new typename Interface::Client_::ResponseValidator_);
+
+ router_ = new Router(handle.Pass(), validators.Pass(), waiter);
ClientProxyWithStub* proxy = new ClientProxyWithStub(router_);
proxy->stub.set_sink(instance_);
router_->set_incoming_receiver(&proxy->stub);

Powered by Google App Engine
This is Rietveld 408576698