[go: nahoru, domu]

TransferableResource allocation attribution

Currently during Viz's Surface Eviction, the Renderer can be holding onto TransferabelResources. We determined in crbug.com/1477385 that
some resources cannot simply be dropped during an eviction.
WebGL/WebGPU have different lifetime expectations.

We want to confirm the current memory scope of the retentions. To
support this we want to label the TransferableResource, so that
at eviction time we can attribute the memory to the various resource
types. To then pursue reclamation where possible

Bug: 1449274

Change-Id: Ie42d6b35c0d2f1c7cef08d62e28ebb87e2761a44
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4885505
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1202646}
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index 2613202..da9ab77 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -174,7 +174,8 @@
   uploaded_resource.viz_resource_id = resource_provider_.ImportResource(
       viz::TransferableResource::MakeGpu(
           uploaded_resource.mailbox, texture_target, sync_token,
-          resource_bitmap.GetSize(), format, /*is_overlay_candidate=*/false),
+          resource_bitmap.GetSize(), format, /*is_overlay_candidate=*/false,
+          viz::TransferableResource::ResourceSource::kUI),
       base::BindOnce(&FrameSinkImpl::UIResourceReleased, base::Unretained(this),
                      resource_id));
   uploaded_resource.size = resource_bitmap.GetSize();