Bug 1482795 - Fix the gfx memory pressure observer. r=sotaro

This commit is contained in:
Nicolas Silva 2018-08-14 21:10:11 +02:00
Родитель 473d7d25c5
Коммит 43aaf84a4c
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -56,7 +56,7 @@ MemoryPressureObserver::Observe(nsISupports* aSubject,
const char* aTopic, const char* aTopic,
const char16_t* aData) const char16_t* aData)
{ {
if (mListener && strcmp(aTopic, "memory-pressure")) { if (mListener && strcmp(aTopic, "memory-pressure") == 0) {
MemoryPressureReason reason = MemoryPressureReason::LOW_MEMORY; MemoryPressureReason reason = MemoryPressureReason::LOW_MEMORY;
auto reason_string = nsDependentString(aData); auto reason_string = nsDependentString(aData);
if (StringBeginsWith(reason_string, NS_LITERAL_STRING("low-memory-ongoing"))) { if (StringBeginsWith(reason_string, NS_LITERAL_STRING("low-memory-ongoing"))) {

Просмотреть файл

@ -1137,7 +1137,7 @@ void
PuppetWidget::OnMemoryPressure(layers::MemoryPressureReason aWhy) PuppetWidget::OnMemoryPressure(layers::MemoryPressureReason aWhy)
{ {
if (aWhy != MemoryPressureReason::LOW_MEMORY_ONGOING && if (aWhy != MemoryPressureReason::LOW_MEMORY_ONGOING &&
mVisible && !mVisible &&
mLayerManager && mLayerManager &&
XRE_IsContentProcess()) { XRE_IsContentProcess()) {
mLayerManager->ClearCachedResources(); mLayerManager->ClearCachedResources();