backout because of Fennec breakage
authorVivien Nicolas <21@vingtetun.org>
Wed, 09 Feb 2011 15:22:50 +0100
changeset 63169 99420cb92ff7f1cd9b4b8bd84ea6498cf0474d07
parent 62200 5300b2ae26ade1f858f4489eea872a82ebcf8485
child 63170 a1d3010eff92e6f1e43ac123bc370aa183edb339
push id19056
push uservnicolas@mozilla.com
push dateMon, 28 Feb 2011 18:09:35 +0000
treeherdermozilla-central@a1d3010eff92 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b12pre
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 because of Fennec breakage
gfx/layers/basic/BasicLayers.cpp
gfx/layers/basic/BasicLayers.h
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -53,17 +53,16 @@
 #include "nsIRenderingContext.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "gfxPattern.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "ThebesLayerBuffer.h"
 #include "nsIWidget.h"
-#include "ReadbackProcessor.h"
 
 #include "GLContext.h"
 
 namespace mozilla {
 namespace layers {
 
 class BasicContainerLayer;
 class ShadowableLayer;
@@ -102,26 +101,19 @@ public:
   }
 
   /**
    * Layers that paint themselves, such as ImageLayers, should paint
    * in response to this method call. aContext will already have been
    * set up to account for all the properties of the layer (transform,
    * opacity, etc).
    */
-  virtual void Paint(gfxContext* aContext) {}
-
-  /**
-   * Like Paint() but called for ThebesLayers with the additional parameters
-   * they need.
-   */
-  virtual void PaintThebes(gfxContext* aContext,
-                           LayerManager::DrawThebesLayerCallback aCallback,
-                           void* aCallbackData,
-                           ReadbackProcessor* aReadback) {}
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData) {}
 
   virtual ShadowableLayer* AsShadowableLayer() { return nsnull; }
 
   /**
    * Implementations return true here if they *must* retain their
    * layer contents.  This is true of shadowable layers with shadows,
    * because there's no target on which to composite directly in the
    * layer-publishing child process.
@@ -383,20 +375,19 @@ public:
   }
   virtual void InvalidateRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mValidRegion.Sub(mValidRegion, aRegion);
   }
 
-  virtual void PaintThebes(gfxContext* aContext,
-                           LayerManager::DrawThebesLayerCallback aCallback,
-                           void* aCallbackData,
-                           ReadbackProcessor* aReadback);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
   virtual void ClearCachedResources() { mBuffer.Clear(); mValidRegion.SetEmpty(); }
   
   virtual already_AddRefed<gfxASurface>
   CreateBuffer(Buffer::ContentType aType, const nsIntSize& aSize)
   {
     nsRefPtr<gfxASurface> referenceSurface = mBuffer.GetBuffer();
     if (!referenceSurface) {
@@ -511,42 +502,34 @@ PushGroupForLayer(gfxContext* aContext, 
     needsClipToVisibleRegion = !didCompleteClip || aRegion.GetNumRects() > 1;
     contentType = gfxASurface::CONTENT_COLOR;
   }
   aContext->PushGroupAndCopyBackground(contentType);
   return needsClipToVisibleRegion;
 }
 
 void
-BasicThebesLayer::PaintThebes(gfxContext* aContext,
-                              LayerManager::DrawThebesLayerCallback aCallback,
-                              void* aCallbackData,
-                              ReadbackProcessor* aReadback)
+BasicThebesLayer::Paint(gfxContext* aContext,
+                        LayerManager::DrawThebesLayerCallback aCallback,
+                        void* aCallbackData)
 {
   NS_ASSERTION(BasicManager()->InDrawing(),
                "Can only draw in drawing phase");
   nsRefPtr<gfxASurface> targetSurface = aContext->CurrentSurface();
 
-  nsTArray<ReadbackProcessor::Update> readbackUpdates;
-  if (aReadback && UsedForReadback()) {
-    aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
-  }
-
   PRBool canUseOpaqueSurface = CanUseOpaqueSurface();
   Buffer::ContentType contentType =
     canUseOpaqueSurface ? gfxASurface::CONTENT_COLOR :
                           gfxASurface::CONTENT_COLOR_ALPHA;
   float opacity = GetEffectiveOpacity();
 
   if (!BasicManager()->IsRetained() ||
       (!canUseOpaqueSurface &&
        (mContentFlags & CONTENT_COMPONENT_ALPHA) &&
        !MustRetainContent())) {
-    NS_ASSERTION(readbackUpdates.IsEmpty(), "Can't do readback for non-retained layer");
-
     mValidRegion.SetEmpty();
     mBuffer.Clear();
 
     nsIntRegion toDraw = IntersectWithClip(mVisibleRegion, aContext);
     if (!toDraw.IsEmpty()) {
       if (!aCallback) {
         BasicManager()->SetTransactionIncomplete();
         return;
@@ -599,30 +582,16 @@ BasicThebesLayer::PaintThebes(gfxContext
       // It's possible that state.mRegionToInvalidate is nonempty here,
       // if we are shrinking the valid region to nothing.
       NS_ASSERTION(state.mRegionToDraw.IsEmpty(),
                    "If we need to draw, we should have a context");
     }
   }
 
   mBuffer.DrawTo(this, aContext, opacity);
-
-  for (PRUint32 i = 0; i < readbackUpdates.Length(); ++i) {
-    ReadbackProcessor::Update& update = readbackUpdates[i];
-    nsIntPoint offset = update.mLayer->GetBackgroundLayerOffset();
-    nsRefPtr<gfxContext> ctx =
-      update.mLayer->GetSink()->BeginUpdate(update.mUpdateRect + offset,
-                                            update.mSequenceCounter);
-    if (ctx) {
-      NS_ASSERTION(opacity == 1.0, "Should only read back opaque layers");
-      ctx->Translate(gfxPoint(offset.x, offset.y));
-      mBuffer.DrawTo(this, ctx, 1.0);
-      update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset);
-    }
-  }
 }
 
 static PRBool
 IsClippingCheap(gfxContext* aTarget, const nsIntRegion& aRegion)
 {
   // Assume clipping is cheap if the context just has an integer
   // translation, and the visible region is simple.
   return !aTarget->CurrentMatrix().HasNonIntegerTranslation() &&
@@ -693,17 +662,19 @@ public:
 
   virtual void SetVisibleRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ImageLayer::SetVisibleRegion(aRegion);
   }
 
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
   static void PaintContext(gfxPattern* aPattern,
                            const nsIntRegion& aVisible,
                            const nsIntRect* aTileSourceRect,
                            float aOpacity,
                            gfxContext* aContext);
 
 protected:
@@ -715,17 +686,19 @@ protected:
   already_AddRefed<gfxPattern>
   GetAndPaintCurrentImage(gfxContext* aContext,
                           float aOpacity);
 
   gfxIntSize mSize;
 };
 
 void
-BasicImageLayer::Paint(gfxContext* aContext)
+BasicImageLayer::Paint(gfxContext* aContext,
+                       LayerManager::DrawThebesLayerCallback aCallback,
+                       void* aCallbackData)
 {
   nsRefPtr<gfxPattern> dontcare =
       GetAndPaintCurrentImage(aContext, GetEffectiveOpacity());
 }
 
 already_AddRefed<gfxPattern>
 BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext,
                                          float aOpacity)
@@ -821,17 +794,19 @@ public:
 
   virtual void SetVisibleRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ColorLayer::SetVisibleRegion(aRegion);
   }
 
-  virtual void Paint(gfxContext* aContext)
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData)
   {
     PaintColorTo(mColor, GetEffectiveOpacity(), aContext);
   }
 
   static void PaintColorTo(gfxRGBA aColor, float aOpacity,
                            gfxContext* aContext);
 
 protected:
@@ -867,17 +842,19 @@ public:
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     CanvasLayer::SetVisibleRegion(aRegion);
   }
 
   virtual void Initialize(const Data& aData);
   virtual void Updated(const nsIntRect& aRect);
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
   virtual void PaintWithOpacity(gfxContext* aContext,
                                 float aOpacity);
 
 protected:
   BasicLayerManager* BasicManager()
   {
     return static_cast<BasicLayerManager*>(mManager);
@@ -977,17 +954,19 @@ BasicCanvasLayer::Updated(const nsIntRec
   }
 
   // sanity
   NS_ASSERTION(mUpdatedRect.IsEmpty() || mBounds.Contains(mUpdatedRect),
                "CanvasLayer: Updated rect bigger than bounds!");
 }
 
 void
-BasicCanvasLayer::Paint(gfxContext* aContext)
+BasicCanvasLayer::Paint(gfxContext* aContext,
+                        LayerManager::DrawThebesLayerCallback aCallback,
+                        void* aCallbackData)
 {
   PaintWithOpacity(aContext, GetEffectiveOpacity());
 }
 
 void
 BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext,
                                    float aOpacity)
 {
@@ -1014,44 +993,16 @@ BasicCanvasLayer::PaintWithOpacity(gfxCo
 
   if (mNeedsYFlip) {
     aContext->SetMatrix(m);
   }
 
   mUpdatedRect.Empty();
 }
 
-class BasicReadbackLayer : public ReadbackLayer,
-                           BasicImplData
-{
-public:
-  BasicReadbackLayer(BasicLayerManager* aLayerManager) :
-    ReadbackLayer(aLayerManager, static_cast<BasicImplData*>(this))
-  {
-    MOZ_COUNT_CTOR(BasicReadbackLayer);
-  }
-  virtual ~BasicReadbackLayer()
-  {
-    MOZ_COUNT_DTOR(BasicReadbackLayer);
-  }
-
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
-  {
-    NS_ASSERTION(BasicManager()->InConstruction(),
-                 "Can only set properties in construction phase");
-    ReadbackLayer::SetVisibleRegion(aRegion);
-  }
-
-protected:
-  BasicLayerManager* BasicManager()
-  {
-    return static_cast<BasicLayerManager*>(mManager);
-  }
-};
-
 static nsIntRect
 ToOutsideIntRect(const gfxRect &aRect)
 {
   gfxRect r = aRect;
   r.RoundOut();
   return nsIntRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
 }
 
@@ -1344,17 +1295,17 @@ BasicLayerManager::EndTransactionInterna
     mSnapEffectiveTransforms =
       !(mTarget->GetFlags() & gfxContext::FLAG_DISABLE_SNAPPING);
     mRoot->ComputeEffectiveTransforms(gfx3DMatrix::From2D(mTarget->CurrentMatrix()));
 
     nsIntRegion region;
     MarkLeafLayersCoveredByOpaque(mRoot,
                                   mRoot->GetEffectiveVisibleRegion().GetBounds(),
                                   region);
-    PaintLayer(mRoot, aCallback, aCallbackData, nsnull);
+    PaintLayer(mRoot, aCallback, aCallbackData);
 
     // If we're doing manual double-buffering, we need to avoid drawing
     // the results of an incomplete transaction to the destination surface.
     // If the transaction is incomplete and we're not double-buffering then
     // either the system is double-buffering our window (in which case the
     // followup EndTransaction will be drawn over the top of our incomplete
     // transaction before the system updates the window), or we have no
     // overlapping or transparent layers in the update region, in which case
@@ -1415,18 +1366,17 @@ BasicLayerManager::SetRoot(Layer* aLayer
   NS_ASSERTION(aLayer->Manager() == this, "Wrong manager");
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
   mRoot = aLayer;
 }
 
 void
 BasicLayerManager::PaintLayer(Layer* aLayer,
                               DrawThebesLayerCallback aCallback,
-                              void* aCallbackData,
-                              ReadbackProcessor* aReadback)
+                              void* aCallbackData)
 {
   const nsIntRect* clipRect = aLayer->GetEffectiveClipRect();
   const gfx3DMatrix& effectiveTransform = aLayer->GetEffectiveTransform();
   PRBool needsGroup = aLayer->GetFirstChild() &&
       static_cast<BasicContainerLayer*>(aLayer)->UseIntermediateSurface();
   // If needsSaveRestore is false, we should still save and restore
   // the CTM
   PRBool needsSaveRestore = needsGroup || clipRect;
@@ -1478,31 +1428,21 @@ BasicLayerManager::PaintLayer(Layer* aLa
   Layer* child = aLayer->GetFirstChild();
   if (!child) {
     BasicImplData* data = ToData(aLayer);
 #ifdef MOZ_LAYERS_HAVE_LOG
     MOZ_LAYERS_LOG(("%s (0x%p) is covered: %i\n", __FUNCTION__,
                    (void*)aLayer, data->IsCoveredByOpaque()));
 #endif
     if (!data->IsCoveredByOpaque()) {
-      if (aLayer->GetType() == Layer::TYPE_THEBES) {
-        data->PaintThebes(mTarget, aCallback, aCallbackData, aReadback);
-      } else {
-        data->Paint(mTarget);
-      }
+      data->Paint(mTarget, aCallback, aCallbackData);
     }
   } else {
-    ReadbackProcessor readback;
-    if (IsRetained()) {
-      ContainerLayer* container = static_cast<ContainerLayer*>(aLayer);
-      readback.BuildUpdates(container);
-    }
-
     for (; child; child = child->GetNextSibling()) {
-      PaintLayer(child, aCallback, aCallbackData, &readback);
+      PaintLayer(child, aCallback, aCallbackData);
       if (mTransactionIncomplete)
         break;
     }
   }
 
   if (needsGroup) {
     mTarget->PopGroupToSource();
     if (needsClipToVisibleRegion) {
@@ -1576,23 +1516,16 @@ BasicLayerManager::CreateColorLayer()
 already_AddRefed<CanvasLayer>
 BasicLayerManager::CreateCanvasLayer()
 {
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
   nsRefPtr<CanvasLayer> layer = new BasicCanvasLayer(this);
   return layer.forget();
 }
 
-already_AddRefed<ReadbackLayer>
-BasicLayerManager::CreateReadbackLayer()
-{
-  NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
-  nsRefPtr<ReadbackLayer> layer = new BasicReadbackLayer(this);
-  return layer.forget();
-}
 
 #ifdef MOZ_IPC
 
 class BasicShadowableThebesLayer;
 class BasicShadowableLayer : public ShadowableLayer
 {
 public:
   BasicShadowableLayer()
@@ -1639,29 +1572,16 @@ public:
 };
 
 static ShadowableLayer*
 ToShadowable(Layer* aLayer)
 {
   return ToData(aLayer)->AsShadowableLayer();
 }
 
-// Some layers, like ReadbackLayers, can't be shadowed and shadowing
-// them doesn't make sense anyway
-static bool
-ShouldShadow(Layer* aLayer)
-{
-  if (!ToShadowable(aLayer)) {
-    NS_ABORT_IF_FALSE(aLayer->GetType() == Layer::TYPE_READBACK,
-                      "Only expect not to shadow ReadbackLayers");
-    return false;
-  }
-  return true;
-}
-
 template<class OpT>
 static BasicShadowableLayer*
 GetBasicShadowable(const OpT& op)
 {
   return static_cast<BasicShadowableLayer*>(
     static_cast<const ShadowLayerChild*>(op.layerChild())->layer());
 }
 
@@ -1699,31 +1619,28 @@ private:
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 };
 
 void
 BasicShadowableContainerLayer::InsertAfter(Layer* aChild, Layer* aAfter)
 {
-  if (HasShadow() && ShouldShadow(aChild)) {
-    while (aAfter && !ShouldShadow(aAfter)) {
-      aAfter = aAfter->GetPrevSibling();
-    }
+  if (HasShadow()) {
     ShadowManager()->InsertAfter(ShadowManager()->Hold(this),
                                  ShadowManager()->Hold(aChild),
                                  aAfter ? ShadowManager()->Hold(aAfter) : nsnull);
   }
   BasicContainerLayer::InsertAfter(aChild, aAfter);
 }
 
 void
 BasicShadowableContainerLayer::RemoveChild(Layer* aChild)
 {
-  if (HasShadow() && ShouldShadow(aChild)) {
+  if (HasShadow()) {
     ShadowManager()->RemoveChild(ShadowManager()->Hold(this),
                                  ShadowManager()->Hold(aChild));
   }
   BasicContainerLayer::RemoveChild(aChild);
 }
 
 static PRBool
 IsSurfaceDescriptorValid(const SurfaceDescriptor& aSurface)
@@ -1937,17 +1854,19 @@ public:
   virtual ~BasicShadowableImageLayer()
   {
     if (mBackSurface) {
       BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackSurface);
     }
     MOZ_COUNT_DTOR(BasicShadowableImageLayer);
   }
 
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
   {
     aAttrs = ImageLayerAttributes(mFilter);
   }
 
   virtual Layer* AsLayer() { return this; }
   virtual ShadowableLayer* AsShadowableLayer() { return this; }
@@ -1968,17 +1887,19 @@ private:
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 
   nsRefPtr<gfxSharedImageSurface> mBackSurface;
 };
  
 void
-BasicShadowableImageLayer::Paint(gfxContext* aContext)
+BasicShadowableImageLayer::Paint(gfxContext* aContext,
+                                 LayerManager::DrawThebesLayerCallback aCallback,
+                                 void* aCallbackData)
 {
   gfxIntSize oldSize = mSize;
   nsRefPtr<gfxPattern> pat = GetAndPaintCurrentImage(aContext, GetEffectiveOpacity());
   if (!pat || !HasShadow())
     return;
 
   if (oldSize != mSize) {
     if (mBackSurface) {
@@ -2053,17 +1974,19 @@ public:
   {
     if (mBackBuffer) {
       BasicManager()->ShadowLayerForwarder::DestroySharedSurface(mBackBuffer);
     }
     MOZ_COUNT_DTOR(BasicShadowableCanvasLayer);
   }
 
   virtual void Initialize(const Data& aData);
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
   {
     aAttrs = CanvasLayerAttributes(mFilter);
   }
 
   virtual Layer* AsLayer() { return this; }
   virtual ShadowableLayer* AsShadowableLayer() { return this; }
@@ -2114,19 +2037,21 @@ BasicShadowableCanvasLayer::Initialize(c
     NS_RUNTIMEABORT("creating CanvasLayer back buffer failed!");
 
   BasicManager()->CreatedCanvasBuffer(BasicManager()->Hold(this),
                                       aData.mSize,
                                       tmpFrontBuffer);
 }
 
 void
-BasicShadowableCanvasLayer::Paint(gfxContext* aContext)
+BasicShadowableCanvasLayer::Paint(gfxContext* aContext,
+                                  LayerManager::DrawThebesLayerCallback aCallback,
+                                  void* aCallbackData)
 {
-  BasicCanvasLayer::Paint(aContext);
+  BasicCanvasLayer::Paint(aContext, aCallback, aCallbackData);
   if (!HasShadow())
     return;
 
   // It'd be nice to draw directly into the shmem back buffer.
   // Doing so is complex -- for 2D canvases, we'd need to copy
   // changed areas, much like we do for Thebes layers, as well as
   // do all sorts of magic to swap out the surface underneath the
   // canvas' thebes/cairo context.
@@ -2239,20 +2164,19 @@ public:
     mOldXResolution = 1.0;
     mOldYResolution = 1.0;
 
     if (IsSurfaceDescriptorValid(mFrontBufferDescriptor)) {
       BasicManager()->ShadowLayerManager::DestroySharedSurface(&mFrontBufferDescriptor, mAllocator);
     }
   }
 
-  virtual void PaintThebes(gfxContext* aContext,
-                           LayerManager::DrawThebesLayerCallback aCallback,
-                           void* aCallbackData,
-                           ReadbackProcessor* aReadback);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
 private:
   BasicShadowLayerManager* BasicManager()
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 
   ShadowThebesLayerBuffer mFrontBuffer;
@@ -2334,20 +2258,19 @@ BasicShadowThebesLayer::Swap(const Thebe
 
   mFrontBufferDescriptor = aNewFront.buffer();
 
   *aReadOnlyFront = aNewFront;
   *aFrontUpdatedRegion = aUpdatedRegion;
 }
 
 void
-BasicShadowThebesLayer::PaintThebes(gfxContext* aContext,
-                                    LayerManager::DrawThebesLayerCallback aCallback,
-                                    void* aCallbackData,
-                                    ReadbackProcessor* aReadback)
+BasicShadowThebesLayer::Paint(gfxContext* aContext,
+                              LayerManager::DrawThebesLayerCallback aCallback,
+                              void* aCallbackData)
 {
   NS_ASSERTION(BasicManager()->InDrawing(),
                "Can only draw in drawing phase");
   NS_ASSERTION(BasicManager()->IsRetained(),
                "ShadowThebesLayer makes no sense without retained mode");
 
   if (!mFrontBuffer.GetBuffer()) {
     return;
@@ -2431,17 +2354,19 @@ public:
   virtual void DestroyFrontBuffer()
   {
     if (mFrontSurface) {
       BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
     }
     mFrontSurface = nsnull;
   }
 
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
 protected:
   BasicShadowLayerManager* BasicManager()
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 
   // XXX ShmemImage?
@@ -2462,17 +2387,19 @@ already_AddRefed<gfxSharedImageSurface>
 BasicShadowImageLayer::Swap(gfxSharedImageSurface* newFront)
 {
   already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
   mFrontSurface = newFront;
   return tmp;
 }
 
 void
-BasicShadowImageLayer::Paint(gfxContext* aContext)
+BasicShadowImageLayer::Paint(gfxContext* aContext,
+                             LayerManager::DrawThebesLayerCallback aCallback,
+                             void* aCallbackData)
 {
   if (!mFrontSurface) {
     return;
   }
 
   nsRefPtr<gfxPattern> pat = new gfxPattern(mFrontSurface);
   pat->SetFilter(mFilter);
   BasicImageLayer::PaintContext(
@@ -2488,17 +2415,19 @@ public:
   {
     MOZ_COUNT_CTOR(BasicShadowColorLayer);
   }
   virtual ~BasicShadowColorLayer()
   {
     MOZ_COUNT_DTOR(BasicShadowColorLayer);
   }
 
-  virtual void Paint(gfxContext* aContext)
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData)
   {
     BasicColorLayer::PaintColorTo(mColor, GetEffectiveOpacity(), aContext);
   }
 };
 
 class BasicShadowCanvasLayer : public ShadowCanvasLayer,
                                BasicImplData
 {
@@ -2530,17 +2459,19 @@ public:
   virtual void DestroyFrontBuffer()
   {
     if (mFrontSurface) {
       BasicManager()->ShadowLayerManager::DestroySharedSurface(mFrontSurface, mAllocator);
     }
     mFrontSurface = nsnull;
   }
 
-  virtual void Paint(gfxContext* aContext);
+  virtual void Paint(gfxContext* aContext,
+                     LayerManager::DrawThebesLayerCallback aCallback,
+                     void* aCallbackData);
 
 private:
   BasicShadowLayerManager* BasicManager()
   {
     return static_cast<BasicShadowLayerManager*>(mManager);
   }
 
   nsRefPtr<gfxSharedImageSurface> mFrontSurface;
@@ -2562,17 +2493,19 @@ already_AddRefed<gfxSharedImageSurface>
 BasicShadowCanvasLayer::Swap(gfxSharedImageSurface* newFront)
 {
   already_AddRefed<gfxSharedImageSurface> tmp = mFrontSurface.forget();
   mFrontSurface = newFront;
   return tmp;
 }
 
 void
-BasicShadowCanvasLayer::Paint(gfxContext* aContext)
+BasicShadowCanvasLayer::Paint(gfxContext* aContext,
+                              LayerManager::DrawThebesLayerCallback aCallback,
+                              void* aCallbackData)
 {
   NS_ASSERTION(BasicManager()->InDrawing(),
                "Can only draw in drawing phase");
 
   if (!mFrontSurface) {
     return;
   }
 
@@ -2733,17 +2666,17 @@ BasicShadowLayerManager::SetRoot(Layer* 
 }
 
 void
 BasicShadowLayerManager::Mutated(Layer* aLayer)
 {
   BasicLayerManager::Mutated(aLayer);
 
   NS_ASSERTION(InConstruction() || InDrawing(), "wrong phase");
-  if (HasShadowManager() && ShouldShadow(aLayer)) {
+  if (HasShadowManager()) {
     ShadowLayerForwarder::Mutated(Hold(aLayer));
   }
 }
 
 void
 BasicShadowLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
 {
   NS_ABORT_IF_FALSE(mKeepAlive.IsEmpty(), "uncommitted txn?");
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -55,17 +55,16 @@ namespace mozilla {
 namespace layers {
 
 class BasicShadowableLayer;
 class ShadowThebesLayer;
 class ShadowContainerLayer;
 class ShadowImageLayer;
 class ShadowCanvasLayer;
 class ShadowColorLayer;
-class ReadbackProcessor;
 
 /**
  * This is a cairo/Thebes-only, main-thread-only implementation of layers.
  * 
  * In each transaction, the client sets up the layer tree and then during
  * the drawing phase, each ThebesLayer is painted directly into the target
  * context (with appropriate clipping and Push/PopGroups performed
  * between layers).
@@ -148,27 +147,26 @@ public:
   virtual void SetRoot(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
   virtual already_AddRefed<ImageContainer> CreateImageContainer();
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
-  virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
   virtual already_AddRefed<ShadowThebesLayer> CreateShadowThebesLayer()
-  { return nsnull; }
+  { return NULL; }
   virtual already_AddRefed<ShadowContainerLayer> CreateShadowContainerLayer()
-  { return nsnull; }
+  { return NULL; }
   virtual already_AddRefed<ShadowImageLayer> CreateShadowImageLayer()
-  { return nsnull; }
+  { return NULL; }
   virtual already_AddRefed<ShadowColorLayer> CreateShadowColorLayer()
-  { return nsnull; }
+  { return NULL; }
   virtual already_AddRefed<ShadowCanvasLayer> CreateShadowCanvasLayer()
-  { return nsnull; }
+  { return NULL; }
 
   virtual LayersBackend GetBackendType() { return LAYERS_BASIC; }
   virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Basic"); }
 
 #ifdef DEBUG
   PRBool InConstruction() { return mPhase == PHASE_CONSTRUCTION; }
   PRBool InDrawing() { return mPhase == PHASE_DRAWING; }
   PRBool InForward() { return mPhase == PHASE_FORWARD; }
@@ -194,18 +192,17 @@ protected:
     PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
   };
   TransactionPhase mPhase;
 #endif
 
   // Paints aLayer to mTarget.
   void PaintLayer(Layer* aLayer,
                   DrawThebesLayerCallback aCallback,
-                  void* aCallbackData,
-                  ReadbackProcessor* aReadback);
+                  void* aCallbackData);
 
   // Clear the contents of a layer
   void ClearLayer(Layer* aLayer);
 
   already_AddRefed<gfxContext> PushGroupWithCachedSurface(gfxContext *aTarget,
                                                           gfxASurface::gfxContentType aContent,
                                                           gfxPoint *aSavedOffset);
   void PopGroupWithCachedSurface(gfxContext *aTarget,