Commit 5d03b167 authored by Sebastien Marchand's avatar Sebastien Marchand Committed by Commit Bot

Send notifications when exiting memory pressure (/gpu)

The current convention is to not send notification when the system exit
memory pressure, this isn't ideal as it doesn't let stateful listeners
know that they should stop their intervention.
This CL was uploaded by git cl split.

R=vmiura@chromium.org

Change-Id: I2c4a53b537d6bfa8391fadd8def543ba525558f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2017047
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: default avatarGeoff Lang <geofflang@chromium.org>
Auto-Submit: Sébastien Marchand <sebmarchand@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736424}
parent 197253bc
......@@ -126,8 +126,6 @@ void GrShaderCache::PurgeMemory(
switch (memory_pressure_level) {
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
// This function is only called with moderate or critical pressure.
NOTREACHED();
return;
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
cache_size_limit_ = cache_size_limit_ / 4;
......
......@@ -200,9 +200,10 @@ void ProgramCache::ComputeProgramHash(
void ProgramCache::HandleMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
// This is only called with moderate or critical pressure.
DCHECK_NE(memory_pressure_level,
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE);
if (memory_pressure_level ==
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE) {
return;
}
// Set a low limit on cache size for MEMORY_PRESSURE_LEVEL_MODERATE.
size_t limit = max_size_bytes_ / 4;
......
......@@ -57,8 +57,6 @@ size_t DiscardableCacheSizeLimitForPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
switch (memory_pressure_level) {
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
// This function is only called with moderate or critical pressure.
NOTREACHED();
return base_cache_limit;
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
// With moderate pressure, shrink to 1/4 our normal size.
......
......@@ -416,8 +416,6 @@ void SharedContextState::PurgeMemory(
switch (memory_pressure_level) {
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
// This function is only called with moderate or critical pressure.
NOTREACHED();
return;
case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
// With moderate pressure, clear any unlocked resources.
......
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