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

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

Issue 2363503002: Mojo C++ bindings: Add a SINGLE_INTERFACE_WITH_SYNC_REQUESTS mode for MultiplexRouter. (Closed)
Patch Set: .. Created 4 years, 3 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/multiplex_router.cc
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.cc b/mojo/public/cpp/bindings/lib/multiplex_router.cc
index d2520f780c9206add2187b03d14b376081843d3f..ef0426fa9765f4f1dc254e1ba2263174cd30ed0d 100644
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc
@@ -291,10 +291,10 @@ MultiplexRouter::MultiplexRouter(
header_validator_(nullptr),
filters_(this),
connector_(std::move(message_pipe),
- config == SINGLE_INTERFACE ? Connector::SINGLE_THREADED_SEND
- : Connector::MULTI_THREADED_SEND,
+ config == MULTI_INTERFACE ? Connector::MULTI_THREADED_SEND
+ : Connector::SINGLE_THREADED_SEND,
std::move(runner)),
- lock_(config == SINGLE_INTERFACE ? nullptr : new base::Lock),
+ lock_(config == MULTI_INTERFACE ? new base::Lock : nullptr),
control_message_handler_(this),
control_message_proxy_(&connector_),
next_interface_id_value_(1),
@@ -303,10 +303,15 @@ MultiplexRouter::MultiplexRouter(
paused_(false),
testing_mode_(false) {
DCHECK(task_runner_->BelongsToCurrentThread());
- // Always participate in sync handle watching, because even if it doesn't
- // expect sync requests during sync handle watching, it may still need to
- // dispatch messages to associated endpoints on a different thread.
- connector_.AllowWokenUpBySyncWatchOnSameThread();
+
+ if (config == SINGLE_INTERFACE_WITH_SYNC_METHODS ||
+ config == MULTI_INTERFACE) {
+ // Always participate in sync handle watching in multi-interface mode,
+ // because even if it doesn't 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(&filters_);
connector_.set_connection_error_handler(
base::Bind(&MultiplexRouter::OnPipeConnectionError,
« no previous file with comments | « mojo/public/cpp/bindings/lib/multiplex_router.h ('k') | mojo/public/cpp/bindings/lib/sync_handle_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698