Don't access Preferences from CompositorLRU. (bug 1287362, r=mattwoodrow)
☠☠ backed out by 777e1b279e39 ☠ ☠
authorDavid Anderson <danderson@mozilla.com>
Mon, 18 Jul 2016 22:54:45 -0700
changeset 330745 b3924432ba210bd01f7e74124d39a92ce0406ce3
parent 330744 bdf984d32e47af35d0203bfc2a1884a884a523d3
child 330746 b0724a9e58bf061c965d46d8f96f1d422235137e
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1287362
milestone50.0a1
Don't access Preferences from CompositorLRU. (bug 1287362, r=mattwoodrow)
gfx/layers/ipc/CompositorBridgeParent.cpp
gfx/layers/ipc/CompositorLRU.cpp
gfx/thebes/gfxPrefs.h
layout/build/nsLayoutStatics.cpp
--- a/gfx/layers/ipc/CompositorBridgeParent.cpp
+++ b/gfx/layers/ipc/CompositorBridgeParent.cpp
@@ -622,16 +622,18 @@ CompositorBridgeParent::CompositorBridge
   , mLastPluginUpdateLayerTreeId(0)
   , mDeferPluginWindows(false)
   , mPluginWindowsHidden(false)
 #endif
 {
   // Always run destructor on the main thread
   MOZ_ASSERT(NS_IsMainThread());
   SetMessageLoopToPostDestructionTo(MessageLoop::current());
+
+  CompositorLRU::Init();
 }
 
 void
 CompositorBridgeParent::InitSameProcess(widget::CompositorWidget* aWidget,
                                         const uint64_t& aLayerTreeId,
                                         bool aUseAPZ)
 {
   mWidget = aWidget;
--- a/gfx/layers/ipc/CompositorLRU.cpp
+++ b/gfx/layers/ipc/CompositorLRU.cpp
@@ -4,20 +4,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "CompositorLRU.h"
 
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/DebugOnly.h"
-#include "mozilla/Preferences.h"
 #include "mozilla/unused.h"
 
 #include "CompositorBridgeParent.h"
+#include "gfxPrefs.h"
 
 namespace mozilla {
 namespace layers {
 
 mozilla::StaticRefPtr<CompositorLRU> CompositorLRU::sSingleton;
 
 void
 CompositorLRU::Init()
@@ -34,17 +34,17 @@ CompositorLRU::GetSingleton()
   sSingleton = new CompositorLRU();
   ClearOnShutdown(&sSingleton);
 
   return sSingleton;
 }
 
 CompositorLRU::CompositorLRU()
 {
-  mLRUSize = Preferences::GetUint("layers.compositor-lru-size", uint32_t(0));
+  mLRUSize = gfxPrefs::LayersCompositorLRUSize();
 }
 
 CompositorLRU::~CompositorLRU()
 {
 }
 
 void
 CompositorLRU::Add(PCompositorBridgeParent* aCompositor, const uint64_t& aId)
--- a/gfx/thebes/gfxPrefs.h
+++ b/gfx/thebes/gfxPrefs.h
@@ -412,16 +412,17 @@ private:
   DECL_GFX_PREF(Once, "image.mem.surfacecache.max_size_kb",    ImageMemSurfaceCacheMaxSizeKB, uint32_t, 100 * 1024);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.min_expiration_ms", ImageMemSurfaceCacheMinExpirationMS, uint32_t, 60*1000);
   DECL_GFX_PREF(Once, "image.mem.surfacecache.size_factor",    ImageMemSurfaceCacheSizeFactor, uint32_t, 64);
   DECL_GFX_PREF(Live, "image.mozsamplesize.enabled",           ImageMozSampleSizeEnabled, bool, false);
   DECL_GFX_PREF(Once, "image.multithreaded_decoding.limit",    ImageMTDecodingLimit, int32_t, -1);
   DECL_GFX_PREF(Live, "image.single-color-optimization.enabled", ImageSingleColorOptimizationEnabled, bool, true);
 
   DECL_GFX_PREF(Live, "layers.child-process-shutdown",         ChildProcessShutdown, bool, true);
+  DECL_GFX_PREF(Live, "layers.compositor-lru-size",            LayersCompositorLRUSize, uint32_t, 0);
   DECL_GFX_PREF(Once, "layers.acceleration.disabled",          LayersAccelerationDisabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps",          LayersDrawFPS, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.print-histogram",  FPSPrintHistogram, bool, false);
   DECL_GFX_PREF(Live, "layers.acceleration.draw-fps.write-to-file", WriteFPSToFile, bool, false);
   DECL_GFX_PREF(Once, "layers.acceleration.force-enabled",     LayersAccelerationForceEnabledDoNotUseDirectly, bool, false);
   DECL_GFX_PREF(Once, "layers.allow-d3d9-fallback",            LayersAllowD3D9Fallback, bool, false);
   DECL_GFX_PREF(Once, "layers.amd-switchable-gfx.enabled",     LayersAMDSwitchableGfxEnabled, bool, false);
   DECL_GFX_PREF(Once, "layers.async-pan-zoom.enabled",         AsyncPanZoomEnabledDoNotUseDirectly, bool, true);
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -305,18 +305,16 @@ nsLayoutStatics::Initialize()
   nsStyleContext::Initialize();
   mozilla::LayerAnimationInfo::Initialize();
 #endif
 
   MediaDecoder::InitStatics();
 
   PromiseDebugging::Init();
 
-  layers::CompositorLRU::Init();
-
   mozilla::dom::devicestorage::DeviceStorageStatics::Initialize();
 
   mozilla::dom::WebCryptoThreadPool::Initialize();
 
 #ifdef MOZ_STYLO
   Servo_Initialize();
 #endif