Commit f0951c81 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

cc: Make EvictAllUIResources only evict resources, not destroy them

This is to limit the error spew in about:gpu (currently any useful
messages are easily lost in warnings about these blank-resource uses).

This function in SetVisible(false) to ensure that resources be dropped
at tab switch. The current implementation immediately deletes the GL
resource backing, even if it may be in use by the display. This results
in flashed-black scrollbars and lots of GL errors.

Change EvictAllUIResources to just evict the resources without
deleting their backing. The resources are then destroyed when they
are returned from the display (at OnUIResourceReleased).

Bug: 864905, 870317
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I1e079e1790275d3194b565457971e65f7d265587
Reviewed-on: https://chromium-review.googlesource.com/1171832
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582453}
parent 5c1e6276
......@@ -5204,8 +5204,11 @@ void LayerTreeHostImpl::ClearUIResources() {
void LayerTreeHostImpl::EvictAllUIResources() {
if (ui_resource_map_.empty())
return;
ClearUIResources();
while (!ui_resource_map_.empty()) {
UIResourceId uid = ui_resource_map_.begin()->first;
DeleteUIResource(uid);
evicted_ui_resources_.insert(uid);
}
client_->SetNeedsCommitOnImplThread();
client_->OnCanDrawStateChanged(CanDraw());
client_->RenewTreePriority();
......
......@@ -598,6 +598,8 @@ class CC_EXPORT LayerTreeHostImpl
const UIResourceBitmap& bitmap);
// Deletes a UI resource. May safely be called more than once.
virtual void DeleteUIResource(UIResourceId uid);
// Evict all UI resources. This differs from ClearUIResources in that this
// will not immediately delete the resources' backing textures.
void EvictAllUIResources();
bool EvictedUIResourcesExist() const;
......
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