Index: ppapi/shared_impl/proxy_lock.h |
diff --git a/ppapi/shared_impl/proxy_lock.h b/ppapi/shared_impl/proxy_lock.h |
index 366504eeb9a7dde3b95c5edae90c248c919868f6..66a5688f334154c1bf268cb73d6157ab784f0626 100644 |
--- a/ppapi/shared_impl/proxy_lock.h |
+++ b/ppapi/shared_impl/proxy_lock.h |
@@ -191,6 +191,12 @@ class RunWhileLockedHelper<void()> { |
// is destroyed on the same thread (see the comments in the destructor). |
DCHECK(ptr->thread_checker_.CalledOnValidThread()); |
ProxyAutoLock lock; |
+ |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
+ |
{ |
// Use a scope and local Callback to ensure that the callback is cleared |
// before the lock is released, even in the unlikely event that Run() |
@@ -222,6 +228,12 @@ class RunWhileLockedHelper<void()> { |
// call the ResourceTracker and also the Resource's destructor, which |
// both require the ProxyLock. |
ProxyAutoLock lock; |
+ |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
+ |
callback_.reset(); |
} |
} |
@@ -246,6 +258,10 @@ class RunWhileLockedHelper<void(P1)> { |
P1 p1) { |
DCHECK(ptr->thread_checker_.CalledOnValidThread()); |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
{ |
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_)); |
temp_callback->Run(p1); |
@@ -255,6 +271,10 @@ class RunWhileLockedHelper<void(P1)> { |
DCHECK(thread_checker_.CalledOnValidThread()); |
if (callback_) { |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
callback_.reset(); |
} |
} |
@@ -278,6 +298,10 @@ class RunWhileLockedHelper<void(P1, P2)> { |
P2 p2) { |
DCHECK(ptr->thread_checker_.CalledOnValidThread()); |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
{ |
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_)); |
temp_callback->Run(p1, p2); |
@@ -287,6 +311,10 @@ class RunWhileLockedHelper<void(P1, P2)> { |
DCHECK(thread_checker_.CalledOnValidThread()); |
if (callback_) { |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
callback_.reset(); |
} |
} |
@@ -311,6 +339,10 @@ class RunWhileLockedHelper<void(P1, P2, P3)> { |
P3 p3) { |
DCHECK(ptr->thread_checker_.CalledOnValidThread()); |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
{ |
std::unique_ptr<CallbackType> temp_callback(std::move(ptr->callback_)); |
temp_callback->Run(p1, p2, p3); |
@@ -320,6 +352,10 @@ class RunWhileLockedHelper<void(P1, P2, P3)> { |
DCHECK(thread_checker_.CalledOnValidThread()); |
if (callback_) { |
ProxyAutoLock lock; |
+ // Relax the cross-thread access restriction to non-thread-safe RefCount. |
+ // |lock| above protects the access to Resource instances. |
+ base::ScopedAllowCrossThreadRefCountAccess |
+ allow_cross_thread_ref_count_access; |
callback_.reset(); |
} |
} |