| Index: components/viz/display_compositor/host_shared_bitmap_manager.cc
|
| diff --git a/components/viz/display_compositor/host_shared_bitmap_manager.cc b/components/viz/display_compositor/host_shared_bitmap_manager.cc
|
| index d781c9439cbe0cd1ae7d5c2b02fec0f63245f994..e0f6ff316dffff5743e96b506c3eac0b9bcb303e 100644
|
| --- a/components/viz/display_compositor/host_shared_bitmap_manager.cc
|
| +++ b/components/viz/display_compositor/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/strings/stringprintf.h"
|
| #include "base/trace_event/process_memory_dump.h"
|
| @@ -51,6 +52,10 @@ class HostSharedBitmap : public cc::SharedBitmap {
|
| manager_->FreeSharedMemoryFromMap(id());
|
| }
|
|
|
| + base::SharedMemory* GetSharedMemory() const override {
|
| + return bitmap_data_->memory.get();
|
| + }
|
| +
|
| private:
|
| scoped_refptr<BitmapData> bitmap_data_;
|
| HostSharedBitmapManager* manager_;
|
| @@ -176,11 +181,16 @@ 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);
|
| + } else {
|
| + // 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);
|
| + }
|
| }
|
|
|
| return true;
|
|
|