Commit 30012f55 authored by Brian Salomon's avatar Brian Salomon Committed by Commit Bot

Delete old GrContext resources in ScheduleGrContextCleanup.

Bug: 883507
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I0918e4b87265acc7367f07e3f7b95c4d8d67851c
Reviewed-on: https://chromium-review.googlesource.com/1224676Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Cr-Commit-Position: refs/heads/master@{#591926}
parent 3d0b890f
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include "gpu/command_buffer/service/gr_cache_controller.h" #include "gpu/command_buffer/service/gr_cache_controller.h"
#include <chrono>
#include "gpu/command_buffer/service/raster_decoder_context_state.h" #include "gpu/command_buffer/service/raster_decoder_context_state.h"
#include "ui/gl/gl_context.h" #include "ui/gl/gl_context.h"
...@@ -27,6 +29,14 @@ void GrCacheController::ScheduleGrContextCleanup() { ...@@ -27,6 +29,14 @@ void GrCacheController::ScheduleGrContextCleanup() {
if (!purge_gr_cache_cb_.IsCancelled()) if (!purge_gr_cache_cb_.IsCancelled())
return; return;
constexpr int kOldResourceCleanupDelaySeconds = 30;
// Here we ask GrContext to free any resources that haven't been used in
// a long while even if it is under budget. Below we set a call back to
// purge all possible GrContext resources if the context itself is not being
// used.
context_state_->gr_context->performDeferredCleanup(
std::chrono::seconds(kOldResourceCleanupDelaySeconds));
constexpr int kIdleCleanupDelaySeconds = 1; constexpr int kIdleCleanupDelaySeconds = 1;
purge_gr_cache_cb_.Reset(base::BindOnce(&GrCacheController::PurgeGrCache, purge_gr_cache_cb_.Reset(base::BindOnce(&GrCacheController::PurgeGrCache,
base::Unretained(this), base::Unretained(this),
......
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