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

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

Issue 2912723002: Revert "Bug fix: TranferBufferManager's SharedMemory memory usage reporting was wrong" (Closed)
Patch Set: (rebase) Created 3 years, 7 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/common/buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/transfer_buffer_manager.cc
diff --git a/gpu/command_buffer/service/transfer_buffer_manager.cc b/gpu/command_buffer/service/transfer_buffer_manager.cc
index 02adf6a2265ff6858411cd82c5891db9ed4cc4bc..4d45c0bb4b520bf927e6edf90e0e36405199a797 100644
--- a/gpu/command_buffer/service/transfer_buffer_manager.cc
+++ b/gpu/command_buffer/service/transfer_buffer_manager.cc
@@ -40,10 +40,8 @@ TransferBufferManager::TransferBufferManager(
TransferBufferManager::~TransferBufferManager() {
while (!registered_buffers_.empty()) {
BufferMap::iterator it = registered_buffers_.begin();
- if (it->second->backing()->is_shared()) {
- DCHECK(shared_memory_bytes_allocated_ >= it->second->size());
- shared_memory_bytes_allocated_ -= it->second->size();
- }
+ DCHECK(shared_memory_bytes_allocated_ >= it->second->size());
+ shared_memory_bytes_allocated_ -= it->second->size();
registered_buffers_.erase(it);
}
DCHECK(!shared_memory_bytes_allocated_);
@@ -73,8 +71,8 @@ bool TransferBufferManager::RegisterTransferBuffer(
DCHECK(!(reinterpret_cast<uintptr_t>(buffer->memory()) &
(kCommandBufferEntrySize - 1)));
- if (buffer->backing()->is_shared())
- shared_memory_bytes_allocated_ += buffer->size();
+ shared_memory_bytes_allocated_ += buffer->size();
+
registered_buffers_[id] = buffer;
return true;
@@ -87,10 +85,9 @@ void TransferBufferManager::DestroyTransferBuffer(int32_t id) {
return;
}
- if (it->second->backing()->is_shared()) {
- DCHECK(shared_memory_bytes_allocated_ >= it->second->size());
- shared_memory_bytes_allocated_ -= it->second->size();
- }
+ DCHECK(shared_memory_bytes_allocated_ >= it->second->size());
+ shared_memory_bytes_allocated_ -= it->second->size();
+
registered_buffers_.erase(it);
}
@@ -132,12 +129,10 @@ bool TransferBufferManager::OnMemoryDump(
MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
dump->AddScalar(MemoryAllocatorDump::kNameSize,
MemoryAllocatorDump::kUnitsBytes, buffer->size());
- if (buffer->backing()->is_shared()) {
- auto guid = GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(),
- buffer_id);
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid);
- }
+ auto guid =
+ GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id);
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid);
}
return true;
« no previous file with comments | « gpu/command_buffer/common/buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698