Bug 1546901 - Call gfxVars::SetProfDirectory() before gfxPlatform::InitLayersIPC() r=nical
authorsotaro <sotaro.ikeda.g@gmail.com>
Thu, 25 Apr 2019 10:17:16 +0000
changeset 471301 1720abb3a1b5872f0629f200268eb01fd15fa1d4
parent 471300 7592e8e3d32eaf4ad5adc9903b04a90a2e623f46
child 471302 25176eee4a95239a5bf2c6558fe0ac46cd6df594
push id112913
push useropoprus@mozilla.com
push dateThu, 25 Apr 2019 22:21:16 +0000
treeherdermozilla-inbound@5279ac14ae48 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1546901
milestone68.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 1546901 - Call gfxVars::SetProfDirectory() before gfxPlatform::InitLayersIPC() r=nical When GPU process does not exist, Render thread is created by gfxPlatform::InitLayersIPC(). Then gfxVars::SetProfDirectory() is called after RenderThread::InitDeviceTask(). Then WebRenderProgramCache could not get correct gfxVars::ProfDirectory() value. It affects to webrender shader disk cache. Differential Revision: https://phabricator.services.mozilla.com/D28793
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -850,16 +850,29 @@ void gfxPlatform::Init() {
       nsAutoString path;
       file->GetPath(path);
       gfxVars::SetGREDirectory(nsString(path));
     }
   }
 
   if (XRE_IsParentProcess()) {
     WrRolloutPrefShutdownSaver::AddShutdownObserver();
+
+    nsCOMPtr<nsIFile> profDir;
+    nsresult rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DIR_STARTUP,
+                                         getter_AddRefs(profDir));
+    if (NS_FAILED(rv)) {
+      gfxVars::SetProfDirectory(nsString());
+    } else {
+      nsAutoString path;
+      profDir->GetPath(path);
+      gfxVars::SetProfDirectory(nsString(path));
+    }
+
+    gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
   }
 
   // Drop a note in the crash report if we end up forcing an option that could
   // destabilize things.  New items should be appended at the end (of an
   // existing or in a new section), so that we don't have to know the version to
   // interpret these cryptic strings.
   {
     nsAutoCString forcedPrefs;
@@ -1043,29 +1056,16 @@ void gfxPlatform::Init() {
   if (XRE_IsParentProcess()) {
     Preferences::Unlock(FONT_VARIATIONS_PREF);
     if (!gPlatform->HasVariationFontSupport()) {
       // Ensure variation fonts are disabled and the pref is locked.
       Preferences::SetBool(FONT_VARIATIONS_PREF, false, PrefValueKind::Default);
       Preferences::SetBool(FONT_VARIATIONS_PREF, false);
       Preferences::Lock(FONT_VARIATIONS_PREF);
     }
-
-    nsCOMPtr<nsIFile> profDir;
-    rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DIR_STARTUP,
-                                getter_AddRefs(profDir));
-    if (NS_FAILED(rv)) {
-      gfxVars::SetProfDirectory(nsString());
-    } else {
-      nsAutoString path;
-      profDir->GetPath(path);
-      gfxVars::SetProfDirectory(nsString(path));
-    }
-
-    gfxUtils::RemoveShaderCacheFromDiskIfNecessary();
   }
 
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   if (obs) {
     obs->NotifyObservers(nullptr, "gfx-features-ready", nullptr);
   }
 }