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

Unified Diff: content/common/host_shared_bitmap_manager.cc

Issue 2775423003: Add ownership edges between HostSharedBitmap and shared memory
Patch Set: Fix comments 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 | « content/child/child_shared_bitmap_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/host_shared_bitmap_manager.cc
diff --git a/content/common/host_shared_bitmap_manager.cc b/content/common/host_shared_bitmap_manager.cc
index f424ac3623e84ead3652816225c6e58b38fef67c..a0ebb2c6eea1c630e3f5b1a60b4b2ca522247252 100644
--- a/content/common/host_shared_bitmap_manager.cc
+++ b/content/common/host_shared_bitmap_manager.cc
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/process_memory_dump.h"
#include "build/build_config.h"
@@ -41,7 +42,7 @@ class HostSharedBitmap : public cc::SharedBitmap {
scoped_refptr<BitmapData> bitmap_data,
const cc::SharedBitmapId& id,
HostSharedBitmapManager* manager)
- : SharedBitmap(pixels, id),
+ : SharedBitmap(pixels, nullptr, id),
bitmap_data_(bitmap_data),
manager_(manager) {}
@@ -173,11 +174,10 @@ bool HostSharedBitmapManager::OnMemoryDump(
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
bitmap.second->buffer_size);
- // Generate a global GUID used to share this allocation with renderer
- // processes.
- auto guid = cc::GetSharedBitmapGUIDForTracing(bitmap.first);
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid);
+ if (bitmap.second->memory) {
+ base::SharedMemoryTracker::AddOwnershipEdges(
+ pmd, dump->guid(), bitmap.second->memory->handle());
+ }
}
return true;
@@ -225,7 +225,7 @@ void HostSharedBitmapManager::AllocateSharedBitmapForChild(
*shared_memory_handle = base::SharedMemory::NULLHandle();
return;
}
- data->memory->Close();
+ data->memory->Close();
}
void HostSharedBitmapManager::ChildDeletedSharedBitmap(
« no previous file with comments | « content/child/child_shared_bitmap_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698