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

Unified Diff: gpu/command_buffer/service/mailbox_manager_sync.cc

Issue 2666423002: Assert sequence validity on non-thread-safe RefCount manipulations (2) (Closed)
Patch Set: rebase Created 3 years, 10 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
Index: gpu/command_buffer/service/mailbox_manager_sync.cc
diff --git a/gpu/command_buffer/service/mailbox_manager_sync.cc b/gpu/command_buffer/service/mailbox_manager_sync.cc
index dd9e6738818d53ca970815db9b34beccdcd2daec..932bd1bbff508b61b42a8a5398ead415ad5a3919 100644
--- a/gpu/command_buffer/service/mailbox_manager_sync.cc
+++ b/gpu/command_buffer/service/mailbox_manager_sync.cc
@@ -194,6 +194,10 @@ bool MailboxManagerSync::UsesSync() {
Texture* MailboxManagerSync::ConsumeTexture(const Mailbox& mailbox) {
base::AutoLock lock(g_lock.Get());
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects non-thread-safe RefCount in TextureGroup.
+ base::ScopedAllowCrossThreadRefCountAccess
+ scoped_allow_cross_thread_ref_count_access;
TextureGroup* group = TextureGroup::FromName(mailbox);
if (!group)
return NULL;
@@ -221,6 +225,10 @@ Texture* MailboxManagerSync::ConsumeTexture(const Mailbox& mailbox) {
void MailboxManagerSync::ProduceTexture(const Mailbox& mailbox,
TextureBase* texture_base) {
base::AutoLock lock(g_lock.Get());
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects non-thread-safe RefCount in TextureGroup.
+ base::ScopedAllowCrossThreadRefCountAccess
+ scoped_allow_cross_thread_ref_count_access;
Texture* texture = static_cast<Texture*>(texture_base);
DCHECK(texture != nullptr);
@@ -268,6 +276,10 @@ void MailboxManagerSync::ProduceTexture(const Mailbox& mailbox,
void MailboxManagerSync::TextureDeleted(TextureBase* texture_base) {
base::AutoLock lock(g_lock.Get());
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects non-thread-safe RefCount in TextureGroup.
+ base::ScopedAllowCrossThreadRefCountAccess
+ scoped_allow_cross_thread_ref_count_access;
Texture* texture = static_cast<Texture*>(texture_base);
DCHECK(texture != nullptr);
@@ -315,6 +327,10 @@ void MailboxManagerSync::UpdateDefinitionLocked(TextureBase* texture_base,
void MailboxManagerSync::PushTextureUpdates(const SyncToken& token) {
base::AutoLock lock(g_lock.Get());
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects non-thread-safe RefCount in TextureGroup.
+ base::ScopedAllowCrossThreadRefCountAccess
+ scoped_allow_cross_thread_ref_count_access;
for (TextureToGroupMap::iterator it = texture_to_group_.begin();
it != texture_to_group_.end(); it++) {
@@ -328,6 +344,10 @@ void MailboxManagerSync::PullTextureUpdates(const SyncToken& token) {
std::vector<TextureUpdatePair> needs_update;
{
base::AutoLock lock(g_lock.Get());
+ // Relax the cross-thread access restriction to non-thread-safe RefCount.
+ // The lock above protects non-thread-safe RefCount in TextureGroup.
+ base::ScopedAllowCrossThreadRefCountAccess
+ scoped_allow_cross_thread_ref_count_access;
AcquireFenceLocked(token);
for (TextureToGroupMap::iterator it = texture_to_group_.begin();

Powered by Google App Engine
This is Rietveld 408576698