Commit 37407399 authored by danakj's avatar danakj Committed by Commit Bot

Add GUIDs for software resource memory dumps in ResourcePool

As per the comments at
https://chromium-review.googlesource.com/c/chromium/src/+/895806/7/cc/resources/resource_pool.cc#b657
we need to add a GUID so that the resource can be corroborated with the
resource in the gpu process. Otherwise the resource will be double-
counted between processes.

R=ericrk@chromium.org, vmpstr@chromium.org

Bug: 807331
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
Change-Id: I6f66b31b640c0ba86a65b1d40fd49f4da3dd06a1
Reviewed-on: https://chromium-review.googlesource.com/897992
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534067}
parent 1c299997
......@@ -12,6 +12,7 @@
#include "base/format_macros.h"
#include "base/memory/memory_coordinator_client_registry.h"
#include "base/memory/shared_memory_handle.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
......@@ -660,6 +661,16 @@ void ResourcePool::PoolResource::OnMemoryDump(
const LayerTreeResourceProvider* resource_provider,
bool dump_parent,
bool is_free) const {
if (!dump_parent) {
// If |dump_parent| is false, the ownership of the resource is in the
// ResourcePool, so we can see if any memory is allocated. If not, then
// don't dump it.
// TODO(danakj): Early out for gpu paths as they move ownership to
// ResourcePool.
if (!shared_bitmap_)
return;
}
// Resource IDs are not process-unique, so log with the
// LayerTreeResourceProvider's unique id.
std::string dump_name =
......@@ -674,6 +685,22 @@ void ResourcePool::PoolResource::OnMemoryDump(
base::StringPrintf("cc/resource_memory/provider_%d/resource_%d",
resource_provider->tracing_id(), resource_id_);
pmd->AddSuballocation(dump->guid(), parent_node);
} else {
// The importance value used here needs to be greater than the importance
// used in other places that use this GUID to inform the system that this is
// the root ownership. The gpu processes uses 0, so 2 is sufficient, and was
// chosen historically and there is no need to adjust it.
const int kImportance = 2;
if (shared_bitmap_) {
base::trace_event::MemoryAllocatorDumpGuid guid =
viz::GetSharedBitmapGUIDForTracing(shared_bitmap_->id());
DCHECK(!guid.empty());
pmd->CreateSharedGlobalAllocatorDump(guid);
pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
}
// TODO(danakj): Gpu paths need to report guids as they move ownership to
// ResourcePool.
}
uint64_t total_bytes =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment