Bug 1563996 - Make dom.ipc.useNativeEventProcessing.content. r=erahm
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 09 Jul 2019 08:00:51 +0000
changeset 481876 d355305743c09ecd0845d650a701809b3f8cf52a
parent 481875 42705dabbde457c42d257d903cc80a4b95fc1899
child 481877 073d453e16f04e2f4293246029f5f165989ab23d
push id113641
push userrgurzau@mozilla.com
push dateTue, 09 Jul 2019 16:13:03 +0000
treeherdermozilla-inbound@f20a93348db5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1563996
milestone70.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 1563996 - Make dom.ipc.useNativeEventProcessing.content. r=erahm Differential Revision: https://phabricator.services.mozilla.com/D37205
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
toolkit/xre/nsAppRunner.cpp
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -1633,16 +1633,29 @@ VARCACHE_PREF(
 
 VARCACHE_PREF(
   Live,
   "dom.ipc.cpows.log.stack",
    dom_ipc_cpows_log_stack,
   bool, false
 )
 
+// Whether a native event loop should be used in the content process.
+VARCACHE_PREF(
+  Live,
+  "dom.ipc.useNativeEventProcessing.content",
+   dom_ipc_useNativeEventProcessing_content,
+  RelaxedAtomicBool,
+#if defined(XP_WIN) || defined(XP_MACOSX)
+  false
+#else
+  true
+#endif
+)
+
 // If this is true, "keypress" event's keyCode value and charCode value always
 // become same if the event is not created/initialized by JS.
 VARCACHE_PREF(
   Live,
   "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value",
   dom_keyboardevent_keypress_set_keycode_and_charcode_to_same_value,
   bool, true
 )
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3128,23 +3128,16 @@ pref("dom.ipc.processCount.privilegedmoz
 // Isolated content processes are always one-per-origin.
 pref("dom.ipc.processCount.webIsolated", 1);
 
 // Keep a single privileged about process alive for performance reasons.
 // e.g. we do not want to throw content processes out every time we navigate
 // away from about:newtab.
 pref("dom.ipc.keepProcessesAlive.privilegedabout", 1);
 
-// Whether a native event loop should be used in the content process.
-#if defined(XP_WIN) || defined(XP_MACOSX)
-pref("dom.ipc.useNativeEventProcessing.content", false);
-#else
-pref("dom.ipc.useNativeEventProcessing.content", true);
-#endif
-
 // Disable support for SVG
 pref("svg.disabled", false);
 
 // Override default dom.ipc.processCount for some remote content process types.
 pref("dom.ipc.processCount.webLargeAllocation", 10);
 
 // Enable the Large-Allocation header
 pref("dom.largeAllocationHeader.enabled", true);
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4959,25 +4959,17 @@ bool XRE_IsE10sParentProcess() {
 
 bool XRE_UseNativeEventProcessing() {
 #if defined(XP_MACOSX) || defined(XP_WIN)
   if (XRE_IsRDDProcess() || XRE_IsSocketProcess()) {
     return false;
   }
 #endif
   if (XRE_IsContentProcess()) {
-    static bool sInited = false;
-    static bool sUseNativeEventProcessing = false;
-    if (!sInited) {
-      Preferences::AddBoolVarCache(&sUseNativeEventProcessing,
-                                   "dom.ipc.useNativeEventProcessing.content");
-      sInited = true;
-    }
-
-    return sUseNativeEventProcessing;
+    return StaticPrefs::dom_ipc_useNativeEventProcessing_content();
   }
 
   return true;
 }
 
 #if defined(XP_WIN)
 bool XRE_Win32kCallsAllowed() {
   switch (XRE_GetProcessType()) {