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

Unified Diff: ppapi/shared_impl/proxy_lock.h

Issue 2666423002: Assert sequence validity on non-thread-safe RefCount manipulations (2) (Closed)
Patch Set: remove DisableSequenceConsistencyAssertions Created 3 years, 9 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
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
}
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | ppapi/shared_impl/tracked_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698