New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 828057 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Report MEMORY_PRESSURE_LEVEL_NONE to listeners

Project Member Reported by dskiba@chromium.org, Apr 2 2018

Issue description

MEMORY_PRESSURE_LEVEL_NONE was added back in 2014 in crrev.com/782053002 with a note that "This event is not sent via callback, but the enum is used in other places to find out the current state of the system".

It looks like at that time there were no stateful MemoryPressureListeners, but now we have 2: v8 and WebMediaPlayer, see this sheet: https://docs.google.com/spreadsheets/d/1tAJGcp2T6RFyag4zFNAOnpmuztTrz0WRNES5pBS9GTs/edit?usp=sharing

In the presence of stateful listeners we have a problem: if memory pressure completely subsides (i.e. goes to NONE) there is no way to notify stateful listeners about that, since NONE is not supposed to be reported.

One way around this is to synthesize fake MODERATE pressure on CRITICAL->NONE transitions, but this complicates platform-specific implementation, and ultimately is a hack.

On the other hand, most MemoryPressureListeners are already handling NONE in one way or another (see the sheet above). Although mostly this is a side effect of having to handle all cases in switch() statement.

Additionally, NONE is the cause of an impedance mismatch between base::MemoryPressureLevel and v8::MemoryPressureLevel. They are identical value-wise, but v8::MemoryPressureLevel::kNone doesn't have "not supposed to be reported" note, and is in fact expected to be reported when pressure subsides (judging from MemoryPressure test in v8/test/cctest/test-api.cc).


Given this I propose to remove the note and allow sending NONE to MemoryPressureListeners.

I see to ways of doing that:

1. Mechanical: introduce MEMORY_PRESSURE_LEVEL_INVALID, replace all usages of NONE with INVALID, add handling of NONE to all listeners.

2. Minimal: don't introduce any new levels, but examine and fix all cases where NONE is treated as "invalid" or "not possible" value. Make sure all listeners are handling NONE.
 
Cc: halliwell@chromium.org

Sign in to add a comment