Bug 369002 - Set os working set trimming behavior for minimized windows as the default on Vista and up. r=robarnold
authorJim Mathies <jmathies@mozilla.com>
Fri, 27 May 2011 17:35:42 -0500
changeset 70262 3b2ad265faf185dabe80f42e861c1b6437b31064
parent 70261 b8c7dd3bddbcf0604d990b66f9a09e48eea8816c
child 70263 dc1077c0954099bddf4861e20d3ade741c756e33
push id20262
push userjmathies@mozilla.com
push dateFri, 27 May 2011 22:36:01 +0000
treeherdermozilla-central@dc1077c09540 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobarnold
bugs369002
milestone7.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 369002 - Set os working set trimming behavior for minimized windows as the default on Vista and up. r=robarnold
widget/src/windows/nsWindow.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -631,29 +631,28 @@ nsWindow::Create(nsIWidget *aParent,
     ::SetWindowLongPtrW(scrollableWnd, GWLP_USERDATA, (LONG_PTR)oldWndProc);
   }
 
   // call the event callback to notify about creation
 
   DispatchStandardEvent(NS_CREATE);
   SubclassWindow(TRUE);
 
+  // If the internal variable set by the config.trim_on_minimize pref has not
+  // been initialized, and if this is the hidden window (conveniently created
+  // before any visible windows, and after the profile has been initialized),
+  // do some initialization work.
   if (sTrimOnMinimize == 2 && mWindowType == eWindowType_invisible) {
-    /* The internal variable set by the config.trim_on_minimize pref
-       has not yet been initialized, and this is the hidden window
-       (conveniently created before any visible windows, and after
-       the profile has been initialized).
-       
-       Default config.trim_on_minimize to false, to fix bug 76831
-       for good.  If anyone complains about this new default, saying
-       that a Mozilla app hogs too much memory while minimized, they
-       will have that entire bug tattooed on their backside. */
-
+    // Our internal trim prevention logic is effective on 2K/XP at maintaining
+    // the working set when windows are minimized, but on Vista and up it has
+    // little to no effect. Since this feature has been the source of numerous
+    // bugs over the years, disable it (sTrimOnMinimize=1) on Vista and up.
     sTrimOnMinimize =
-      Preferences::GetBool("config.trim_on_minimize", PR_FALSE) ? 1 : 0;
+      Preferences::GetBool("config.trim_on_minimize",
+                           (GetWindowsVersion() >= VISTA_VERSION)) ? 1 : 0;
     sSwitchKeyboardLayout =
       Preferences::GetBool("intl.keyboard.per_window_layout", PR_FALSE);
     gDisableNativeTheme =
       Preferences::GetBool("mozilla.widget.disable-native-theme", PR_FALSE);
   }
 
   return NS_OK;
 }