Bug 1450314 - Remove unused parameters for memory-pressure notifications. r?gsvelto draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 06 May 2018 13:17:11 +0200
changeset 794360 a22265490d6c497d6f3d6b4a336291a4d917700a
parent 794299 e603468003542a702125197a4045dfbc55282dc9
push id109655
push usermozilla@buttercookie.de
push dateFri, 11 May 2018 19:56:29 +0000
reviewersgsvelto
bugs1450314, 1234176
milestone62.0a1
Bug 1450314 - Remove unused parameters for memory-pressure notifications. r?gsvelto "alloc-failure" is completely unused apart from the description text in nsI- Memory.idl (and has been since before Firefox 17), while "lowering-priority" is still being checked for in the PuppetWidget, but otherwise unused as well since the feature using it was decommissioned in bug 1234176. Since we're touching the PuppetWidget code anyway, we take the opportunity to add a check for "low-memory-ongoing" instead, since similar as to how things used to be with "lowering-priority", we want to drop the LayerManager's cached resources only when receiving a real full memory-pressure event, but not for subsequent ongoing notifications. MozReview-Commit-ID: HL03SOU8axe
widget/PuppetWidget.cpp
xpcom/base/nsIMemory.idl
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -1145,17 +1145,18 @@ PuppetWidget::MemoryPressureObserver::Ob
                                               const char* aTopic,
                                               const char16_t* aData)
 {
   if (!mWidget) {
     return NS_OK;
   }
 
   if (strcmp("memory-pressure", aTopic) == 0 &&
-      !NS_LITERAL_STRING("lowering-priority").Equals(aData)) {
+      !StringBeginsWith(nsDependentString(aData),
+                        NS_LITERAL_STRING("low-memory-ongoing"))) {
     if (!mWidget->mVisible && mWidget->mLayerManager &&
         XRE_IsContentProcess()) {
       mWidget->mLayerManager->ClearCachedResources();
     }
   }
   return NS_OK;
 }
 
--- a/xpcom/base/nsIMemory.idl
+++ b/xpcom/base/nsIMemory.idl
@@ -35,27 +35,16 @@
  * "-no-forward"
  * This is appended to the above two parameters when the resulting
  * notification should not be forwarded to the child processes.
  *
  * "heap-minimize"
  * This will be passed as the extra data when the pressure 
  * observer is being asked to flush because of a heap minimize 
  * call.
- *
- * "alloc-failure"
- * This will be passed as the extra data when the pressure 
- * observer has been asked to flush because a malloc() or 
- * realloc() has failed.
- *
- * "lowering-priority"
- * This will be passed as the extra data when the priority of a child
- * process is lowered. The pressure observers could take the chance to
- * clear caches that could be easily regenerated. This type of
- * notification only appears in child processes.
  */
 
 [scriptable, uuid(1e004834-6d8f-425a-bc9c-a2812ed43bb7)]
 interface nsIMemory : nsISupports
 {
     /**
      * Attempts to shrink the heap.
      * @param immediate - if true, heap minimization will occur