Index: mojo/public/cpp/bindings/lib/multiplex_router.h |
diff --git a/mojo/public/cpp/bindings/lib/multiplex_router.h b/mojo/public/cpp/bindings/lib/multiplex_router.h |
index 84272d3aef4dd66193b54feb0f17d2428e71a679..26de3df13b9a12d55c9fd9991c67c301e873c85b 100644 |
--- a/mojo/public/cpp/bindings/lib/multiplex_router.h |
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.h |
@@ -56,10 +56,22 @@ class MultiplexRouter |
public AssociatedGroupController, |
public PipeControlMessageHandlerDelegate { |
public: |
+ enum Config { |
+ // There is only the master interface running on this router. Please note |
+ // that because of interface versioning, the other side of the message pipe |
+ // may use a newer master interface definition which passes associated |
+ // interfaces. In that case, this router may still receive pipe control |
+ // messages or messages targetting associated interfaces. |
+ SINGLE_INTERFACE, |
+ // There may be associated interfaces running on this router. |
+ MULTI_INTERFACE |
+ }; |
+ |
// If |set_interface_id_namespace_bit| is true, the interface IDs generated by |
// this router will have the highest bit set. |
- MultiplexRouter(bool set_interface_id_namespace_bit, |
- ScopedMessagePipeHandle message_pipe, |
+ MultiplexRouter(ScopedMessagePipeHandle message_pipe, |
+ Config config, |
+ bool set_interface_id_namespace_bit, |
scoped_refptr<base::SingleThreadTaskRunner> runner); |
// Sets the master interface name for this router. Only used when reporting |
@@ -205,6 +217,8 @@ class MultiplexRouter |
InterfaceEndpoint* FindOrInsertEndpoint(InterfaceId id, bool* inserted); |
+ void AssertLockAcquired(); |
+ |
// Whether to set the namespace bit when generating interface IDs. Please see |
// comments of kInterfaceIdNamespaceMask. |
const bool set_interface_id_namespace_bit_; |
@@ -220,7 +234,8 @@ class MultiplexRouter |
base::ThreadChecker thread_checker_; |
// Protects the following members. |
- mutable base::Lock lock_; |
+ // Sets to nullptr in Config::SINGLE_INTERFACE mode. |
+ std::unique_ptr<base::Lock> lock_; |
PipeControlMessageHandler control_message_handler_; |
PipeControlMessageProxy control_message_proxy_; |