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 ef3ca35d2b6d7d15e701ab1bbb4ed15d466fcc0e..07aafc9f6313070a99c8c8ae1038abcbb42a353d 100644 |
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc |
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc |
@@ -427,6 +427,10 @@ InterfaceId MultiplexRouter::AssociateInterface( |
uint32_t id = 0; |
{ |
MayAutoLock locker(lock_.get()); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
do { |
if (next_interface_id_value_ >= kInterfaceIdNamespaceMask) |
next_interface_id_value_ = 1; |
@@ -464,6 +468,10 @@ ScopedInterfaceEndpointHandle MultiplexRouter::CreateLocalEndpointHandle( |
return ScopedInterfaceEndpointHandle(); |
MayAutoLock locker(lock_.get()); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
bool inserted = false; |
InterfaceEndpoint* endpoint = FindOrInsertEndpoint(id, &inserted); |
if (inserted) { |
@@ -492,6 +500,10 @@ void MultiplexRouter::CloseEndpointHandle( |
return; |
MayAutoLock locker(lock_.get()); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
DCHECK(base::ContainsKey(endpoints_, id)); |
InterfaceEndpoint* endpoint = endpoints_[id].get(); |
DCHECK(!endpoint->client()); |
@@ -516,6 +528,10 @@ InterfaceEndpointController* MultiplexRouter::AttachEndpointClient( |
DCHECK(client); |
MayAutoLock locker(lock_.get()); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
DCHECK(base::ContainsKey(endpoints_, id)); |
InterfaceEndpoint* endpoint = endpoints_[id].get(); |
@@ -685,6 +701,10 @@ void MultiplexRouter::OnPipeConnectionError() { |
scoped_refptr<MultiplexRouter> protector(this); |
MayAutoLock locker(lock_.get()); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
encountered_error_ = true; |
@@ -710,6 +730,10 @@ void MultiplexRouter::ProcessTasks( |
ClientCallBehavior client_call_behavior, |
base::SingleThreadTaskRunner* current_task_runner) { |
AssertLockAcquired(); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
if (posted_to_process_tasks_) |
return; |