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 2da459ae8f8ca5ee8704164bbeefaad3a93a2c88..005731ee4e207e24fa5f1a26634f21f25b2ae05e 100644 |
--- a/mojo/public/cpp/bindings/lib/multiplex_router.cc |
+++ b/mojo/public/cpp/bindings/lib/multiplex_router.cc |
@@ -431,6 +431,10 @@ InterfaceId MultiplexRouter::AssociateInterface( |
uint32_t id = 0; |
{ |
MayAutoLock locker(&lock_); |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // The lock above protects |endpoint|. |
+ base::ScopedAllowCrossThreadRefCountAccess |
yzshen1
2017/03/06 17:53:52
Can this opt-out be configured with a type (in thi
|
+ allow_cross_thread_ref_count_access; |
do { |
if (next_interface_id_value_ >= kInterfaceIdNamespaceMask) |
next_interface_id_value_ = 1; |
@@ -468,6 +472,10 @@ ScopedInterfaceEndpointHandle MultiplexRouter::CreateLocalEndpointHandle( |
return ScopedInterfaceEndpointHandle(); |
MayAutoLock locker(&lock_); |
+ // 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) { |
@@ -496,6 +504,10 @@ void MultiplexRouter::CloseEndpointHandle( |
return; |
MayAutoLock locker(&lock_); |
+ // 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()); |
@@ -520,6 +532,10 @@ InterfaceEndpointController* MultiplexRouter::AttachEndpointClient( |
DCHECK(client); |
MayAutoLock locker(&lock_); |
+ // 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(); |
@@ -692,6 +708,10 @@ void MultiplexRouter::OnPipeConnectionError() { |
scoped_refptr<MultiplexRouter> protector(this); |
MayAutoLock locker(&lock_); |
+ // 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; |
@@ -717,6 +737,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; |