Bug 1312100 - Enable a11y with e10s for Linux/OSX on all channels. r=felipe
authorJim Mathies <jmathies@mozilla.com>
Wed, 02 Nov 2016 07:26:41 -0500
changeset 320781 6dca348b9b1d4d09bf42ca3bf5633d255a392cd7
parent 320780 9beb0764b238011e6b35a06185978fb01957c2d2
child 320782 dc36f70ecd19375e6bbb183d463c122265912a64
push id83449
push usercbook@mozilla.com
push dateThu, 03 Nov 2016 07:56:46 +0000
treeherdermozilla-inbound@dc36f70ecd19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1312100
milestone52.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 1312100 - Enable a11y with e10s for Linux/OSX on all channels. r=felipe MozReview-Commit-ID: Ex7T5S6MNJR
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4815,27 +4815,28 @@ enum {
   kE10sForceDisabled = 8,
   // kE10sDisabledForXPAcceleration = 9, removed in bug 1296353
   kE10sDisabledForOperatingSystem = 10,
 };
 
 const char* kAccessibilityLastRunDatePref = "accessibility.lastLoadDate";
 const char* kAccessibilityLoadedLastSessionPref = "accessibility.loadedInLastSession";
 
+#if defined(XP_WIN)
 static inline uint32_t
 PRTimeToSeconds(PRTime t_usec)
 {
   PRTime usec_per_sec = PR_USEC_PER_SEC;
   return uint32_t(t_usec /= usec_per_sec);
 }
+#endif
 
 const char* kForceEnableE10sPref = "browser.tabs.remote.force-enable";
 const char* kForceDisableE10sPref = "browser.tabs.remote.force-disable";
 
-
 uint32_t
 MultiprocessBlockPolicy() {
   if (gMultiprocessBlockPolicyInitialized) {
     return gMultiprocessBlockPolicy;
   }
   gMultiprocessBlockPolicyInitialized = true;
 
   /**
@@ -4850,60 +4851,53 @@ MultiprocessBlockPolicy() {
                                                       : NS_LITERAL_CSTRING("0"));
 #endif
 
   if (addonsCanDisable && disabledByAddons) {
     gMultiprocessBlockPolicy = kE10sDisabledForAddons;
     return gMultiprocessBlockPolicy;
   }
 
-  bool disabledForA11y = false;
-
-  /**
-   * Avoids enabling e10s if accessibility has recently loaded. Performs the
-   * following checks:
-   * 1) Checks a pref indicating if a11y loaded in the last session. This pref
-   * is set in nsBrowserGlue.js. If a11y was loaded in the last session we
-   * do not enable e10s in this session.
-   * 2) Accessibility stores a last run date (PR_IntervalNow) when it is
-   * initialized (see nsBaseWidget.cpp). We check if this pref exists and
-   * compare it to now. If a11y hasn't run in an extended period of time or
-   * if the date pref does not exist we load e10s.
-   */
-  disabledForA11y = Preferences::GetBool(kAccessibilityLoadedLastSessionPref, false);
-  if (!disabledForA11y  &&
-      Preferences::HasUserValue(kAccessibilityLastRunDatePref)) {
-    #define ONE_WEEK_IN_SECONDS (60*60*24*7)
-    uint32_t a11yRunDate = Preferences::GetInt(kAccessibilityLastRunDatePref, 0);
-    MOZ_ASSERT(0 != a11yRunDate);
-    // If a11y hasn't run for a period of time, clear the pref and load e10s
-    uint32_t now = PRTimeToSeconds(PR_Now());
-    uint32_t difference = now - a11yRunDate;
-    if (difference > ONE_WEEK_IN_SECONDS || !a11yRunDate) {
-      Preferences::ClearUser(kAccessibilityLastRunDatePref);
-    } else {
-      disabledForA11y = true;
+#if defined(XP_WIN)
+  // These checks are currently only in use under WinXP
+  if (!IsVistaOrLater()) {
+    bool disabledForA11y = false;
+    /**
+      * Avoids enabling e10s if accessibility has recently loaded. Performs the
+      * following checks:
+      * 1) Checks a pref indicating if a11y loaded in the last session. This pref
+      * is set in nsBrowserGlue.js. If a11y was loaded in the last session we
+      * do not enable e10s in this session.
+      * 2) Accessibility stores a last run date (PR_IntervalNow) when it is
+      * initialized (see nsBaseWidget.cpp). We check if this pref exists and
+      * compare it to now. If a11y hasn't run in an extended period of time or
+      * if the date pref does not exist we load e10s.
+      */
+    disabledForA11y = Preferences::GetBool(kAccessibilityLoadedLastSessionPref, false);
+    if (!disabledForA11y  &&
+        Preferences::HasUserValue(kAccessibilityLastRunDatePref)) {
+      #define ONE_WEEK_IN_SECONDS (60*60*24*7)
+      uint32_t a11yRunDate = Preferences::GetInt(kAccessibilityLastRunDatePref, 0);
+      MOZ_ASSERT(0 != a11yRunDate);
+      // If a11y hasn't run for a period of time, clear the pref and load e10s
+      uint32_t now = PRTimeToSeconds(PR_Now());
+      uint32_t difference = now - a11yRunDate;
+      if (difference > ONE_WEEK_IN_SECONDS || !a11yRunDate) {
+        Preferences::ClearUser(kAccessibilityLastRunDatePref);
+      } else {
+        disabledForA11y = true;
+      }
+    }
+    if (disabledForA11y) {
+      gMultiprocessBlockPolicy = kE10sDisabledForAccessibility;
+      return gMultiprocessBlockPolicy;
     }
   }
-
-  bool doAccessibilityCheck = true;
-#if defined(MOZ_WIDGET_GTK) && !defined(RELEASE_OR_BETA)
-  // For linux nightly and aurora builds skip accessibility
-  // checks.
-  doAccessibilityCheck = false;
-#elif defined(XP_WIN)
-  // For Windows Vista and up, skip accessibility checks.
-  doAccessibilityCheck = !IsVistaOrLater();
 #endif
 
-  if (doAccessibilityCheck && disabledForA11y) {
-    gMultiprocessBlockPolicy = kE10sDisabledForAccessibility;
-    return gMultiprocessBlockPolicy;
-  }
-
   /**
    * Avoids enabling e10s for Windows XP users on the release channel.
    */
 #if defined(XP_WIN)
   if (Preferences::GetDefaultCString("app.update.channel").EqualsLiteral("release") &&
       !IsVistaOrLater()) {
     gMultiprocessBlockPolicy = kE10sDisabledForOperatingSystem;
     return gMultiprocessBlockPolicy;