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

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

Issue 2276043002: Support custom message filtering on Mojo binding objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 4 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/lib/multiplex_router.h ('k') | mojo/public/cpp/bindings/lib/router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/multiplex_router.cc
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index cc11f17a1f27c0f117e91c04cdcab915b4aafbb0..4e888afba42873e211b7d22e9b74d0434194bbaa 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -286,7 +286,8 @@ MultiplexRouter::MultiplexRouter(
scoped_refptr<base::SingleThreadTaskRunner> runner)
: set_interface_id_namespace_bit_(set_interface_id_namesapce_bit),
task_runner_(runner),
- header_validator_(this),
+ header_validator_(nullptr),
+ filters_(this),
connector_(std::move(message_pipe),
Connector::MULTI_THREADED_SEND,
std::move(runner)),
@@ -302,10 +303,15 @@ MultiplexRouter::MultiplexRouter(
// expect sync requests during sync handle watching, it may still need to
// dispatch messages to associated endpoints on a different thread.
connector_.AllowWokenUpBySyncWatchOnSameThread();
- connector_.set_incoming_receiver(&header_validator_);
+ connector_.set_incoming_receiver(&filters_);
connector_.set_connection_error_handler(
base::Bind(&MultiplexRouter::OnPipeConnectionError,
base::Unretained(this)));
+
+ std::unique_ptr<MessageHeaderValidator> header_validator =
+ base::MakeUnique<MessageHeaderValidator>();
+ header_validator_ = header_validator.get();
+ filters_.Append(std::move(header_validator));
}
MultiplexRouter::~MultiplexRouter() {
@@ -329,7 +335,7 @@ MultiplexRouter::~MultiplexRouter() {
void MultiplexRouter::SetMasterInterfaceName(const std::string& name) {
DCHECK(thread_checker_.CalledOnValidThread());
- header_validator_.SetDescription(name + " [master] MessageHeaderValidator");
+ header_validator_->SetDescription(name + " [master] MessageHeaderValidator");
control_message_handler_.SetDescription(
name + " [master] PipeControlMessageHandler");
}
« no previous file with comments | « mojo/public/cpp/bindings/lib/multiplex_router.h ('k') | mojo/public/cpp/bindings/lib/router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698