Bug 1342927 - Add a hidden pref to disable force painting of tabs so that browser_tabSpinnerProbe.js can pass. r=billm
☠☠ backed out by b51280e3f8e6 ☠ ☠
authorMike Conley <mconley@mozilla.com>
Wed, 01 Mar 2017 15:36:51 -0500
changeset 345918 7d79c8090f75d66a1c39821273d5760fdb94a23e
parent 345917 9d44c499c3dbfdbb6312608012f142a82f1835fb
child 345919 9a3a43ae9b2d219503b561318d31f25aa4df58b8
push id38340
push usermconley@mozilla.com
push dateSat, 04 Mar 2017 04:46:30 +0000
treeherderautoland@7d79c8090f75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1342927
milestone54.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 1342927 - Add a hidden pref to disable force painting of tabs so that browser_tabSpinnerProbe.js can pass. r=billm MozReview-Commit-ID: 4q2dSBmvVV9
browser/base/content/test/tabs/browser_tabSpinnerProbe.js
dom/ipc/ProcessHangMonitor.cpp
--- a/browser/base/content/test/tabs/browser_tabSpinnerProbe.js
+++ b/browser/base/content/test/tabs/browser_tabSpinnerProbe.js
@@ -80,14 +80,22 @@ function* testProbe(aProbe) {
   yield BrowserTestUtils.removeTab(tab2);
   yield BrowserTestUtils.removeTab(tab1);
   ok(sum(snapshot.counts) > 0,
    `Spinner probe should now have a value in some bucket`);
 }
 
 add_task(function* setup() {
   yield SpecialPowers.pushPrefEnv({
-    set: [["dom.ipc.processCount", 1]]
+    set: [
+      ["dom.ipc.processCount", 1],
+      // We can interrupt JS to paint now, which is great for
+      // users, but bad for testing spinners. We temporarily
+      // disable that feature for this test so that we can
+      // easily get ourselves into a predictable tab spinner
+      // state.
+      ["browser.tabs.remote.force-paint", false],
+    ]
   });
 });
 
 add_task(testProbe.bind(null, "FX_TAB_SWITCH_SPINNER_VISIBLE_MS"));
 add_task(testProbe.bind(null, "FX_TAB_SWITCH_SPINNER_VISIBLE_LONG_MS"));
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -270,18 +270,22 @@ private:
 
   // Must be accessed with mMonitor held.
   RefPtr<HangMonitoredProcess> mProcess;
   bool mShutdownDone;
   // Map from plugin ID to crash dump ID. Protected by mBrowserCrashDumpHashLock.
   nsDataHashtable<nsUint32HashKey, nsString> mBrowserCrashDumpIds;
   Mutex mBrowserCrashDumpHashLock;
   mozilla::ipc::TaskFactory<HangMonitorParent> mMainThreadTaskFactory;
+
+  static bool sShouldForcePaint;
 };
 
+bool HangMonitorParent::sShouldForcePaint = true;
+
 } // namespace
 
 /* HangMonitorChild implementation */
 
 HangMonitorChild::HangMonitorChild(ProcessHangMonitor* aMonitor)
  : mHangMonitor(aMonitor),
    mMonitor("HangMonitorChild lock"),
    mSentReport(false),
@@ -570,16 +574,23 @@ HangMonitorParent::HangMonitorParent(Pro
    mIPCOpen(true),
    mMonitor("HangMonitorParent lock"),
    mShutdownDone(false),
    mBrowserCrashDumpHashLock("mBrowserCrashDumpIds lock"),
    mMainThreadTaskFactory(this)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   mReportHangs = mozilla::Preferences::GetBool("dom.ipc.reportProcessHangs", false);
+
+  static bool sInited = false;
+  if (!sInited) {
+    sInited = true;
+    Preferences::AddBoolVarCache(&sShouldForcePaint,
+                                 "browser.tabs.remote.force-paint", true);
+  }
 }
 
 HangMonitorParent::~HangMonitorParent()
 {
 #ifdef MOZ_CRASHREPORTER
   MutexAutoLock lock(mBrowserCrashDumpHashLock);
 
   for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) {
@@ -627,19 +638,21 @@ HangMonitorParent::ShutdownOnThread()
   mShutdownDone = true;
   mMonitor.Notify();
 }
 
 void
 HangMonitorParent::ForcePaint(dom::TabParent* aTab, uint64_t aLayerObserverEpoch)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
-  TabId id = aTab->GetTabId();
-  MonitorLoop()->PostTask(NewNonOwningRunnableMethod<TabId, uint64_t>(
-                            this, &HangMonitorParent::ForcePaintOnThread, id, aLayerObserverEpoch));
+  if (sShouldForcePaint) {
+    TabId id = aTab->GetTabId();
+    MonitorLoop()->PostTask(NewNonOwningRunnableMethod<TabId, uint64_t>(
+                              this, &HangMonitorParent::ForcePaintOnThread, id, aLayerObserverEpoch));
+  }
 }
 
 void
 HangMonitorParent::DispatchTabChildNotReady(TabId aTabId)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (!mProcess) {
     return;