Backout chanset 9c18f3e4d02a and e784bb7b9f21 because b2g emulator bustage
authorKan-Ru Chen <kanru@kanru.info>
Thu, 14 May 2015 15:59:17 +0800
changeset 274561 1229539b527cbcfe5e07afb11878e28ef6a09868
parent 274560 5017c72ac8aa928a83a9934b5bb4d0a8621715fa
child 274562 5f661a622c57e3495867fbecc4ce9d90a8f4d1d1
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone41.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
Backout chanset 9c18f3e4d02a and e784bb7b9f21 because b2g emulator bustage
b2g/app/b2g.js
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
gfx/layers/ipc/CompositorChild.cpp
gfx/layers/ipc/CompositorChild.h
gfx/layers/ipc/CompositorLRU.cpp
gfx/layers/ipc/CompositorLRU.h
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
gfx/layers/ipc/PCompositor.ipdl
gfx/layers/moz.build
layout/build/nsLayoutStatics.cpp
modules/libpref/init/all.js
widget/PuppetWidget.cpp
widget/PuppetWidget.h
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -1135,11 +1135,8 @@ pref("gfx.touch.resample", true);
 
 // Comma separated list of activity names that can only be provided by
 // the system app in dev mode.
 pref("dom.activities.developer_mode_only", "import-app");
 
 // mulet apparently loads firefox.js as well as b2g.js, so we have to explicitly
 // disable serviceworkers here to get them disabled in mulet.
 pref("dom.serviceWorkers.enabled", false);
-
-// Retain at most 10 processes' layers buffers
-pref("layers.compositor-lru-size", 10);
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2973,33 +2973,27 @@ TabChild::NotifyPainted()
         mRemoteFrame->SendNotifyCompositorTransaction();
         mNotified = true;
     }
 }
 
 void
 TabChild::MakeVisible()
 {
-  CompositorChild* compositor = CompositorChild::Get();
-  compositor->SendNotifyVisible(mLayersId);
-
-  if (mWidget) {
-    mWidget->Show(true);
-  }
+    if (mWidget) {
+        mWidget->Show(true);
+    }
 }
 
 void
 TabChild::MakeHidden()
 {
-  CompositorChild* compositor = CompositorChild::Get();
-  compositor->SendNotifyHidden(mLayersId);
-
-  if (mWidget) {
-    mWidget->Show(false);
-  }
+    if (mWidget) {
+        mWidget->Show(false);
+    }
 }
 
 void
 TabChild::UpdateHitRegion(const nsRegion& aRegion)
 {
     mRemoteFrame->SendUpdateHitRegion(aRegion);
 }
 
@@ -3131,27 +3125,16 @@ TabChild::DidComposite(uint64_t aTransac
   MOZ_ASSERT(mWidget);
   MOZ_ASSERT(mWidget->GetLayerManager());
   MOZ_ASSERT(mWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT);
 
   ClientLayerManager *manager = static_cast<ClientLayerManager*>(mWidget->GetLayerManager());
   manager->DidComposite(aTransactionId);
 }
 
-void
-TabChild::ClearCachedResources()
-{
-  MOZ_ASSERT(mWidget);
-  MOZ_ASSERT(mWidget->GetLayerManager());
-  MOZ_ASSERT(mWidget->GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT);
-
-  ClientLayerManager *manager = static_cast<ClientLayerManager*>(mWidget->GetLayerManager());
-  manager->ClearCachedResources();
-}
-
 NS_IMETHODIMP
 TabChild::OnShowTooltip(int32_t aXCoords, int32_t aYCoords, const char16_t *aTipText)
 {
     nsString str(aTipText);
     SendShowTooltip(aXCoords, aYCoords, str);
     return NS_OK;
 }
 
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -467,17 +467,16 @@ public:
       nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
       return static_cast<TabChild*>(tc.get());
     }
 
     static TabChild* GetFrom(nsIPresShell* aPresShell);
     static TabChild* GetFrom(uint64_t aLayersId);
 
     void DidComposite(uint64_t aTransactionId);
-    void ClearCachedResources();
 
     static inline TabChild*
     GetFrom(nsIDOMWindow* aWindow)
     {
       nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
       nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
       return GetFrom(docShell);
     }
--- a/gfx/layers/ipc/CompositorChild.cpp
+++ b/gfx/layers/ipc/CompositorChild.cpp
@@ -367,26 +367,16 @@ CompositorChild::RecvOverfill(const uint
 
 void
 CompositorChild::AddOverfillObserver(ClientLayerManager* aLayerManager)
 {
   MOZ_ASSERT(aLayerManager);
   mOverfillObservers.AppendElement(aLayerManager);
 }
 
-bool
-CompositorChild::RecvClearCachedResources(const uint64_t& aId)
-{
-  dom::TabChild* child = dom::TabChild::GetFrom(aId);
-  if (child) {
-    child->ClearCachedResources();
-  }
-  return true;
-}
-
 void
 CompositorChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   MOZ_ASSERT(!mCanSend);
   MOZ_ASSERT(sCompositor == this);
 
 #ifdef MOZ_B2G
   // Due to poor lifetime management of gralloc (and possibly shmems) we will
@@ -555,36 +545,16 @@ CompositorChild::SendResume()
   MOZ_ASSERT(mCanSend);
   if (!mCanSend) {
     return true;
   }
   return PCompositorChild::SendResume();
 }
 
 bool
-CompositorChild::SendNotifyHidden(const uint64_t& id)
-{
-  MOZ_ASSERT(mCanSend);
-  if (!mCanSend) {
-    return true;
-  }
-  return PCompositorChild::SendNotifyHidden(id);
-}
-
-bool
-CompositorChild::SendNotifyVisible(const uint64_t& id)
-{
-  MOZ_ASSERT(mCanSend);
-  if (!mCanSend) {
-    return true;
-  }
-  return PCompositorChild::SendNotifyVisible(id);
-}
-
-bool
 CompositorChild::SendNotifyChildCreated(const uint64_t& id)
 {
   MOZ_ASSERT(mCanSend);
   if (!mCanSend) {
     return true;
   }
   return PCompositorChild::SendNotifyChildCreated(id);
 }
--- a/gfx/layers/ipc/CompositorChild.h
+++ b/gfx/layers/ipc/CompositorChild.h
@@ -66,19 +66,16 @@ public:
 
   static CompositorChild* Get();
 
   static bool ChildProcessHasCompositor() { return sCompositor != nullptr; }
 
   void AddOverfillObserver(ClientLayerManager* aLayerManager);
 
   virtual bool
-  RecvClearCachedResources(const uint64_t& id) override;
-
-  virtual bool
   RecvDidComposite(const uint64_t& aId, const uint64_t& aTransactionId) override;
 
   virtual bool
   RecvInvalidateAll() override;
 
   virtual bool
   RecvOverfill(const uint32_t &aOverfill) override;
 
@@ -104,18 +101,16 @@ public:
   // are not virtual), they just overload them.
   // All of these Send* methods just add a sanity check (that it is not too late
   // send a message) and forward the call to the super-class's equivalent method.
   // This means that it is correct to call directly the super-class methods, but
   // you won't get the extra safety provided here.
   bool SendWillStop();
   bool SendPause();
   bool SendResume();
-  bool SendNotifyHidden(const uint64_t& id);
-  bool SendNotifyVisible(const uint64_t& id);
   bool SendNotifyChildCreated(const uint64_t& id);
   bool SendAdoptChild(const uint64_t& id);
   bool SendMakeSnapshot(const SurfaceDescriptor& inSnapshot, const gfx::IntRect& dirtyRect);
   bool SendFlushRendering();
   bool SendGetTileSize(int32_t* tileWidth, int32_t* tileHeight);
   bool SendStartFrameTimeRecording(const int32_t& bufferSize, uint32_t* startIndex);
   bool SendStopFrameTimeRecording(const uint32_t& startIndex, nsTArray<float>* intervals);
   bool SendNotifyRegionInvalidated(const nsIntRegion& region);
deleted file mode 100644
--- a/gfx/layers/ipc/CompositorLRU.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* 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 "CompositorParent.h"
-
-namespace mozilla {
-namespace layers {
-
-mozilla::StaticRefPtr<CompositorLRU> CompositorLRU::sSingleton;
-
-void
-CompositorLRU::Init()
-{
-  unused << GetSingleton();
-}
-
-CompositorLRU*
-CompositorLRU::GetSingleton()
-{
-  if (sSingleton) {
-    return sSingleton;
-  }
-  sSingleton = new CompositorLRU();
-  ClearOnShutdown(&sSingleton);
-
-  return sSingleton;
-}
-
-CompositorLRU::CompositorLRU()
-{
-  mLRUSize = Preferences::GetUint("layers.compositor-lru-size", uint32_t(0));
-}
-
-CompositorLRU::~CompositorLRU()
-{
-}
-
-void
-CompositorLRU::Add(PCompositorParent* aCompositor, const uint64_t& aId)
-{
-  DebugOnly<nsTArray<CompositorLayerPair>::index_type> index =
-    mLRU.IndexOf(std::make_pair(aCompositor, aId));
-  MOZ_ASSERT(index == nsTArray<CompositorLayerPair>::NoIndex);
-
-  if (mLRUSize == 0) {
-    unused << aCompositor->SendClearCachedResources(aId);
-    return;
-  }
-
-  if (mLRU.Length() == mLRUSize) {
-    CompositorLayerPair victim = mLRU.LastElement();
-    unused << victim.first->SendClearCachedResources(victim.second);
-    mLRU.RemoveElement(victim);
-  }
-  mLRU.InsertElementAt(0, std::make_pair(aCompositor, aId));
-}
-
-void
-CompositorLRU::Remove(PCompositorParent* aCompositor, const uint64_t& aId)
-{
-  if (mLRUSize == 0) {
-    return;
-  }
-
-  auto index = mLRU.IndexOf(std::make_pair(aCompositor, aId));
-
-  if (index == nsTArray<PCompositorParent*>::NoIndex) {
-    return;
-  }
-
-  mLRU.RemoveElementAt(index);
-}
-
-void
-CompositorLRU::Remove(PCompositorParent* aCompositor)
-{
-  if (mLRUSize == 0) {
-    return;
-  }
-
-  for (auto i = mLRU.Length() - 1; i > 0; --i) {
-    if (mLRU[i].first == aCompositor) {
-      mLRU.RemoveElementAt(i);
-    }
-  }
-}
-
-} // namespace layers
-} // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/ipc/CompositorLRU.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* 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/. */
-
-#ifndef mozilla_CompositorLRU_h
-#define mozilla_CompositorLRU_h
-
-#include "mozilla/StaticPtr.h"
-
-#include "nsISupportsImpl.h"
-#include "nsTArray.h"
-
-#include <utility>
-
-namespace mozilla {
-namespace layers {
-
-class PCompositorParent;
-
-class CompositorLRU final
-{
-  typedef std::pair<PCompositorParent*, uint64_t> CompositorLayerPair;
-public:
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositorLRU)
-
-  static void Init();
-  static CompositorLRU* GetSingleton();
-
-  /**
-   * Adds the (PCompositorParent, LayerId) pair to the LRU pool. If
-   * the pool size grows over mLRUSize, the oldest PCompositorParent
-   * is evicted.
-   */
-  void Add(PCompositorParent* aCompositor, const uint64_t& id);
-
-  /**
-   * Remove the (PCompositorParent, LayersId) pair from the LRU pool.
-   */
-  void Remove(PCompositorParent* aCompositor, const uint64_t& id);
-
-  /**
-   * Remove all PCompositorParents from the LRU pool.
-   */
-  void Remove(PCompositorParent* aCompositor);
-
-private:
-  static StaticRefPtr<CompositorLRU> sSingleton;
-
-  CompositorLRU();
-  ~CompositorLRU();
-  uint32_t mLRUSize;
-  nsTArray<CompositorLayerPair> mLRU;
-};
-
-} // namespace layers
-} // namespace mozilla
-
-#endif // mozilla_CompositorLRU_h
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -29,17 +29,16 @@
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/gfx/Rect.h"          // for IntSize
 #include "mozilla/ipc/Transport.h"      // for Transport
 #include "mozilla/layers/APZCTreeManager.h"  // for APZCTreeManager
 #include "mozilla/layers/APZThreadUtils.h"  // for APZCTreeManager
 #include "mozilla/layers/AsyncCompositionManager.h"
 #include "mozilla/layers/BasicCompositor.h"  // for BasicCompositor
 #include "mozilla/layers/Compositor.h"  // for Compositor
-#include "mozilla/layers/CompositorLRU.h"  // for CompositorLRU
 #include "mozilla/layers/CompositorOGL.h"  // for CompositorOGL
 #include "mozilla/layers/CompositorTypes.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/PLayerTransactionParent.h"
 #include "mozilla/layers/ShadowLayersManager.h" // for ShadowLayersManager
 #include "mozilla/mozalloc.h"           // for operator new, etc
 #include "mozilla/Telemetry.h"
@@ -1682,18 +1681,16 @@ public:
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   // FIXME/bug 774388: work out what shutdown protocol we need.
   virtual bool RecvRequestOverfill() override { return true; }
   virtual bool RecvWillStop() override { return true; }
   virtual bool RecvStop() override { return true; }
   virtual bool RecvPause() override { return true; }
   virtual bool RecvResume() override { return true; }
-  virtual bool RecvNotifyHidden(const uint64_t& id) override;
-  virtual bool RecvNotifyVisible(const uint64_t& id) override;
   virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
   virtual bool RecvAdoptChild(const uint64_t& child) override { return false; }
   virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
                                 const gfx::IntRect& aRect) override
   { return true; }
   virtual bool RecvFlushRendering() override { return true; }
   virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; }
   virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) override { return true; }
@@ -1840,44 +1837,25 @@ CompositorParent::GetIndirectShadowTree(
   LayerTreeMap::iterator cit = sIndirectLayerTrees.find(aId);
   if (sIndirectLayerTrees.end() == cit) {
     return nullptr;
   }
   return &cit->second;
 }
 
 bool
-CrossProcessCompositorParent::RecvNotifyHidden(const uint64_t& id)
-{
-  nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
-  lru->Add(this, id);
-  return true;
-}
-
-bool
-CrossProcessCompositorParent::RecvNotifyVisible(const uint64_t& id)
-{
-  nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
-  lru->Remove(this, id);
-  return true;
-}
-
-bool
 CrossProcessCompositorParent::RecvRequestNotifyAfterRemotePaint()
 {
   mNotifyAfterRemotePaint = true;
   return true;
 }
 
 void
 CrossProcessCompositorParent::ActorDestroy(ActorDestroyReason aWhy)
 {
-  nsRefPtr<CompositorLRU> lru = CompositorLRU::GetSingleton();
-  lru->Remove(this);
-
   MessageLoop::current()->PostTask(
     FROM_HERE,
     NewRunnableMethod(this, &CrossProcessCompositorParent::DeferredDestroy));
 }
 
 PLayerTransactionParent*
 CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArray<LayersBackend>&,
                                                            const uint64_t& aId,
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -229,18 +229,16 @@ public:
                 base::ProcessHandle aPeerProcess,
                 mozilla::ipc::ProtocolCloneContext* aCtx) override;
 
   virtual bool RecvRequestOverfill() override;
   virtual bool RecvWillStop() override;
   virtual bool RecvStop() override;
   virtual bool RecvPause() override;
   virtual bool RecvResume() override;
-  virtual bool RecvNotifyHidden(const uint64_t& id) override { return true; }
-  virtual bool RecvNotifyVisible(const uint64_t& id) override { return true; }
   virtual bool RecvNotifyChildCreated(const uint64_t& child) override;
   virtual bool RecvAdoptChild(const uint64_t& child) override;
   virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
                                 const gfx::IntRect& aRect) override;
   virtual bool RecvFlushRendering() override;
 
   virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override;
 
--- a/gfx/layers/ipc/PCompositor.ipdl
+++ b/gfx/layers/ipc/PCompositor.ipdl
@@ -65,45 +65,31 @@ child:
                                    PluginWindowData[] aPlugins);
 
   /**
    * Sets the list of currently visible plugin windows based on a
    * list of plugin window ids.
    */
   async UpdatePluginVisibility(uintptr_t[] aVisibleIdList);
 
-  /**
-   * Drop any buffers that might be retained on the child compositor
-   * side.
-   */
-  async ClearCachedResources(uint64_t id);
-
 parent:
   // Child sends the parent a request for fill ratio numbers.
   async RequestOverfill();
 
   // The child is about to be destroyed, so perform any necessary cleanup.
   sync WillStop();
 
   // Clean up in preparation for own destruction.
   sync Stop();
 
   // Pause/resume the compositor. These are intended to be used on mobile, when
   // the compositor needs to pause/resume in lockstep with the application.
   sync Pause();
   sync Resume();
 
-  // The child layer tree is hidden. id is the layers id of the child
-  // layer tree.
-  async NotifyHidden(uint64_t id);
-
-  // The child layer tree is visible. id is the layers id of the child
-  // layer tree.
-  async NotifyVisible(uint64_t id);
-
   async NotifyChildCreated(uint64_t id);
   async AdoptChild(uint64_t id);
 
   // Make a snapshot of the content that would have been drawn to our
   // render target at the time this message is received.  If the size
   // or format of |inSnapshot| doesn't match our render target,
   // results are undefined.
   //
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -134,17 +134,16 @@ EXPORTS.mozilla.layers += [
     'D3D11ShareHandleImage.h',
     'D3D9SurfaceImage.h',
     'Effects.h',
     'ImageDataSerializer.h',
     'ipc/AsyncTransactionTracker.h',
     'ipc/CompositableForwarder.h',
     'ipc/CompositableTransactionParent.h',
     'ipc/CompositorChild.h',
-    'ipc/CompositorLRU.h',
     'ipc/CompositorParent.h',
     'ipc/FenceUtils.h',
     'ipc/ImageBridgeChild.h',
     'ipc/ImageBridgeParent.h',
     'ipc/ISurfaceAllocator.h',
     'ipc/LayerTransactionChild.h',
     'ipc/LayerTransactionParent.h',
     'ipc/ShadowLayers.h',
@@ -290,17 +289,16 @@ UNIFIED_SOURCES += [
     'Effects.cpp',
     'GLImages.cpp',
     'ImageDataSerializer.cpp',
     'ImageLayers.cpp',
     'ipc/AsyncTransactionTracker.cpp',
     'ipc/CompositableTransactionParent.cpp',
     'ipc/CompositorBench.cpp',
     'ipc/CompositorChild.cpp',
-    'ipc/CompositorLRU.cpp',
     'ipc/CompositorParent.cpp',
     'ipc/ImageBridgeChild.cpp',
     'ipc/ImageBridgeParent.cpp',
     'ipc/ISurfaceAllocator.cpp',
     'ipc/LayerTransactionChild.cpp',
     'ipc/LayerTransactionParent.cpp',
     'ipc/ShadowLayerChild.cpp',
     'ipc/ShadowLayerParent.cpp',
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -134,17 +134,16 @@ using namespace mozilla::system;
 #include "mozilla/dom/time/DateCacheCleaner.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/IMEStateManager.h"
 #include "nsDocument.h"
 #include "mozilla/dom/HTMLVideoElement.h"
 #include "CameraPreferences.h"
 #include "TouchManager.h"
 #include "MediaDecoder.h"
-#include "mozilla/layers/CompositorLRU.h"
 
 using namespace mozilla;
 using namespace mozilla::net;
 using namespace mozilla::dom;
 using namespace mozilla::dom::ipc;
 
 nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
 
@@ -316,18 +315,16 @@ nsLayoutStatics::Initialize()
   nsStyleContext::Initialize();
   mozilla::css::CommonAnimationManager::Initialize();
 #endif
 
   MediaDecoder::InitStatics();
 
   PromiseDebugging::Init();
 
-  layers::CompositorLRU::Init();
-
   return NS_OK;
 }
 
 void
 nsLayoutStatics::Shutdown()
 {
   // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
   // memory reporter manager.
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4120,19 +4120,16 @@ pref("layers.d3d11.disable-warp", false)
 
 // Force all possible layers to be always active layers
 pref("layers.force-active", false);
 
 // Never use gralloc surfaces, even when they're available on this
 // platform and are the optimal surface type.
 pref("layers.gralloc.disable", false);
 
-// Don't use compositor-lru on this platform
-pref("layers.compositor-lru-size", 0);
-
 // Enable/Disable the geolocation API for content
 pref("geo.enabled", true);
 
 // Enable/Disable the orientation API for content
 pref("device.sensors.enabled", true);
 
 // Enable/Disable the device storage API for content
 pref("device.storage.enabled", false);
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -113,21 +113,16 @@ PuppetWidget::Create(nsIWidget        *a
   PuppetWidget* parent = static_cast<PuppetWidget*>(aParent);
   if (parent) {
     parent->SetChild(this);
     mLayerManager = parent->GetLayerManager();
   }
   else {
     Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, false);
   }
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (obs) {
-    mMemoryPressureObserver = new MemoryPressureObserver(this);
-    obs->AddObserver(mMemoryPressureObserver, "memory-pressure", false);
-  }
 
   return NS_OK;
 }
 
 void
 PuppetWidget::InitIMEState()
 {
   MOZ_ASSERT(mTabChild);
@@ -153,19 +148,16 @@ PuppetWidget::CreateChild(const nsIntRec
 }
 
 NS_IMETHODIMP
 PuppetWidget::Destroy()
 {
   Base::OnDestroy();
   Base::Destroy();
   mPaintTask.Revoke();
-  if (mMemoryPressureObserver) {
-    mMemoryPressureObserver->Remove();
-  }
   mChild = nullptr;
   if (mLayerManager) {
     mLayerManager->Destroy();
   }
   mLayerManager = nullptr;
   mTabChild = nullptr;
   return NS_OK;
 }
@@ -178,16 +170,20 @@ PuppetWidget::Show(bool aState)
 
   bool wasVisible = mVisible;
   mVisible = aState;
 
   if (mChild) {
     mChild->mVisible = aState;
   }
 
+  if (!mVisible && mLayerManager) {
+    mLayerManager->ClearCachedResources();
+  }
+
   if (!wasVisible && mVisible) {
     Resize(mBounds.width, mBounds.height, false);
     Invalidate(mBounds);
   }
 
   return NS_OK;
 }
 
@@ -1036,45 +1032,16 @@ NS_IMETHODIMP
 PuppetWidget::PaintTask::Run()
 {
   if (mWidget) {
     mWidget->Paint();
   }
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS(PuppetWidget::MemoryPressureObserver, nsIObserver)
-
-NS_IMETHODIMP
-PuppetWidget::MemoryPressureObserver::Observe(nsISupports* aSubject,
-                                              const char* aTopic,
-                                              const char16_t* aData)
-{
-  if (!mWidget) {
-    return NS_OK;
-  }
-
-  if (strcmp("memory-pressure", aTopic) == 0) {
-    if (!mWidget->mVisible && mWidget->mLayerManager) {
-      mWidget->mLayerManager->ClearCachedResources();
-    }
-  }
-  return NS_OK;
-}
-
-void
-PuppetWidget::MemoryPressureObserver::Remove()
-{
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (obs) {
-    obs->RemoveObserver(this, "memory-pressure");
-  }
-  mWidget = nullptr;
-}
-
 bool
 PuppetWidget::NeedsPaint()
 {
   // e10s popups are handled by the parent process, so never should be painted here
   if (XRE_GetProcessType() == GeckoProcessType_Content &&
       Preferences::GetBool("browser.tabs.remote.desktopbehavior", false) &&
       mWindowType == eWindowType_popup) {
     NS_WARNING("Trying to paint an e10s popup in the child process!");
--- a/widget/PuppetWidget.h
+++ b/widget/PuppetWidget.h
@@ -274,41 +274,28 @@ private:
   public:
     NS_DECL_NSIRUNNABLE
     explicit PaintTask(PuppetWidget* widget) : mWidget(widget) {}
     void Revoke() { mWidget = nullptr; }
   private:
     PuppetWidget* mWidget;
   };
 
-  class MemoryPressureObserver : public nsIObserver {
-  public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIOBSERVER
-    explicit MemoryPressureObserver(PuppetWidget* aWidget) : mWidget(aWidget) {}
-    void Remove();
-  private:
-    virtual ~MemoryPressureObserver() {}
-    PuppetWidget* mWidget;
-  };
-  friend class MemoryPressureObserver;
-
   // TabChild normally holds a strong reference to this PuppetWidget
   // or its root ancestor, but each PuppetWidget also needs a
   // reference back to TabChild (e.g. to delegate nsIWidget IME calls
   // to chrome) So we hold a weak reference to TabChild here.  Since
   // it's possible for TabChild to outlive the PuppetWidget, we clear
   // this weak reference in Destroy()
   TabChild* mTabChild;
   // The "widget" to which we delegate events if we don't have an
   // event handler.
   nsRefPtr<PuppetWidget> mChild;
   nsIntRegion mDirtyRegion;
   nsRevocableEventPtr<PaintTask> mPaintTask;
-  nsRefPtr<MemoryPressureObserver> mMemoryPressureObserver;
   // XXX/cjones: keeping this around until we teach LayerManager to do
   // retained-content-only transactions
   mozilla::RefPtr<DrawTarget> mDrawTarget;
   // IME
   nsIMEUpdatePreference mIMEPreferenceOfParent;
   // Latest seqno received through events
   uint32_t mIMELastReceivedSeqno;
   // Chrome's seqno value when last blur occurred