Bug 1482795 - Fix the gfx memory pressure observer. r=sotaro
authorNicolas Silva <nsilva@mozilla.com>
Tue, 14 Aug 2018 21:10:11 +0200
changeset 431550 d4a387207b7ae2cb4a431c62ff78a526e12c2ee2
parent 431549 2ceb7952766db7caf602bc5f09427bb973cd1017
child 431551 cb79c9adc1a6c772550702399bdfb3d0d3417966
push id34443
push usercsabou@mozilla.com
push dateWed, 15 Aug 2018 00:53:32 +0000
treeherdermozilla-central@b80906e2fbc9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssotaro
bugs1482795
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1482795 - Fix the gfx memory pressure observer. r=sotaro
gfx/layers/MemoryPressureObserver.cpp
widget/PuppetWidget.cpp
--- a/gfx/layers/MemoryPressureObserver.cpp
+++ b/gfx/layers/MemoryPressureObserver.cpp
@@ -51,17 +51,17 @@ MemoryPressureObserver::Unregister()
   mListener = nullptr;
 }
 
 NS_IMETHODIMP
 MemoryPressureObserver::Observe(nsISupports* aSubject,
                                 const char* aTopic,
                                 const char16_t* aData)
 {
-  if (mListener && strcmp(aTopic, "memory-pressure")) {
+  if (mListener && strcmp(aTopic, "memory-pressure") == 0) {
     MemoryPressureReason reason = MemoryPressureReason::LOW_MEMORY;
     auto reason_string = nsDependentString(aData);
     if (StringBeginsWith(reason_string, NS_LITERAL_STRING("low-memory-ongoing"))) {
         reason = MemoryPressureReason::LOW_MEMORY_ONGOING;
     } else if (StringBeginsWith(reason_string, NS_LITERAL_STRING("heap-minimize"))) {
         reason = MemoryPressureReason::HEAP_MINIMIZE;
     }
     mListener->OnMemoryPressure(reason);
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1132,17 +1132,17 @@ PuppetWidget::PaintNowIfNeeded()
     Paint();
   }
 }
 
 void
 PuppetWidget::OnMemoryPressure(layers::MemoryPressureReason aWhy)
 {
   if (aWhy != MemoryPressureReason::LOW_MEMORY_ONGOING &&
-      mVisible &&
+      !mVisible &&
       mLayerManager &&
       XRE_IsContentProcess()) {
     mLayerManager->ClearCachedResources();
   }
 }
 
 bool
 PuppetWidget::NeedsPaint()