2010-07-21 14:17:33 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
#include "ShadowLayers.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include <set> // for _Rb_tree_const_iterator, etc
|
|
|
|
#include <vector> // for vector
|
2013-08-22 00:11:51 -07:00
|
|
|
#include "GeckoProfiler.h" // for PROFILER_LABEL
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "ISurfaceAllocator.h" // for IsSurfaceDescriptorValid
|
|
|
|
#include "Layers.h" // for Layer
|
|
|
|
#include "RenderTrace.h" // for RenderTraceScope
|
|
|
|
#include "ShadowLayerChild.h" // for ShadowLayerChild
|
2013-12-20 08:46:29 -08:00
|
|
|
#include "gfx2DGlue.h" // for Moz2D transition helpers
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "gfxPlatform.h" // for gfxImageFormat, gfxPlatform
|
|
|
|
#include "gfxSharedImageSurface.h" // for gfxSharedImageSurface
|
|
|
|
#include "ipc/IPCMessageUtils.h" // for gfxContentType, null_t
|
|
|
|
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
|
2013-12-20 08:46:30 -08:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableClient, etc
|
2013-09-06 08:41:00 -07:00
|
|
|
#include "mozilla/layers/LayersMessages.h" // for Edit, etc
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
|
|
|
#include "mozilla/layers/LayersTypes.h" // for MOZ_LAYERS_LOG
|
2013-11-27 07:19:34 -08:00
|
|
|
#include "mozilla/layers/LayerTransactionChild.h"
|
2013-08-11 16:17:23 -07:00
|
|
|
#include "ShadowLayerUtils.h"
|
|
|
|
#include "mozilla/layers/TextureClient.h" // for TextureClient
|
|
|
|
#include "mozilla/mozalloc.h" // for operator new, etc
|
|
|
|
#include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc
|
|
|
|
#include "nsDebug.h" // for NS_ABORT_IF_FALSE, etc
|
|
|
|
#include "nsRect.h" // for nsIntRect
|
|
|
|
#include "nsSize.h" // for nsIntSize
|
|
|
|
#include "nsTArray.h" // for nsAutoTArray, nsTArray, etc
|
|
|
|
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-08-11 16:17:23 -07:00
|
|
|
struct nsIntPoint;
|
2013-05-27 07:12:13 -07:00
|
|
|
|
2010-09-27 17:59:43 -07:00
|
|
|
using namespace mozilla::ipc;
|
2012-10-25 13:12:59 -07:00
|
|
|
using namespace mozilla::gl;
|
2012-11-21 18:40:57 -08:00
|
|
|
using namespace mozilla::dom;
|
2010-09-27 17:59:43 -07:00
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace mozilla {
|
2013-08-11 16:17:23 -07:00
|
|
|
namespace ipc {
|
|
|
|
class Shmem;
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace layers {
|
|
|
|
|
2014-03-07 13:34:04 -08:00
|
|
|
class ClientTiledLayerBuffer;
|
2013-08-11 16:17:23 -07:00
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
typedef nsTArray<SurfaceDescriptor> BufferArray;
|
2010-07-21 14:17:33 -07:00
|
|
|
typedef std::vector<Edit> EditVector;
|
|
|
|
typedef std::set<ShadowableLayer*> ShadowableLayerSet;
|
|
|
|
|
|
|
|
class Transaction
|
|
|
|
{
|
|
|
|
public:
|
2012-05-01 12:23:39 -07:00
|
|
|
Transaction()
|
2013-02-25 21:18:20 -08:00
|
|
|
: mTargetRotation(ROTATION_0)
|
|
|
|
, mSwapRequired(false)
|
2012-05-18 01:29:38 -07:00
|
|
|
, mOpen(false)
|
2012-11-06 01:11:43 -08:00
|
|
|
, mRotationChanged(false)
|
2012-05-01 12:23:39 -07:00
|
|
|
{}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2012-11-21 18:40:57 -08:00
|
|
|
void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation,
|
|
|
|
const nsIntRect& aClientBounds, ScreenOrientation aOrientation)
|
2012-07-24 12:01:09 -07:00
|
|
|
{
|
|
|
|
mOpen = true;
|
|
|
|
mTargetBounds = aTargetBounds;
|
2012-11-06 01:11:43 -08:00
|
|
|
if (aRotation != mTargetRotation) {
|
2013-02-25 21:18:20 -08:00
|
|
|
// the first time this is called, mRotationChanged will be false if
|
|
|
|
// aRotation is 0, but we should be OK because for the first transaction
|
|
|
|
// we should only compose if it is non-empty. See the caller(s) of
|
|
|
|
// RotationChanged.
|
|
|
|
mRotationChanged = true;
|
2012-11-06 01:11:43 -08:00
|
|
|
}
|
2012-07-24 12:01:09 -07:00
|
|
|
mTargetRotation = aRotation;
|
2012-11-21 18:40:57 -08:00
|
|
|
mClientBounds = aClientBounds;
|
|
|
|
mTargetOrientation = aOrientation;
|
2012-07-24 12:01:09 -07:00
|
|
|
}
|
2013-09-12 07:50:28 -07:00
|
|
|
void MarkSyncTransaction()
|
|
|
|
{
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
void AddEdit(const Edit& aEdit)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mCset.push_back(aEdit);
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void AddEdit(const CompositableOperation& aEdit)
|
|
|
|
{
|
|
|
|
AddEdit(Edit(aEdit));
|
|
|
|
}
|
2010-09-15 14:03:13 -07:00
|
|
|
void AddPaint(const Edit& aPaint)
|
2012-05-01 12:23:39 -07:00
|
|
|
{
|
|
|
|
AddNoSwapPaint(aPaint);
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void AddPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
|
|
|
AddNoSwapPaint(Edit(aPaint));
|
|
|
|
mSwapRequired = true;
|
|
|
|
}
|
|
|
|
|
2012-05-01 12:23:39 -07:00
|
|
|
void AddNoSwapPaint(const Edit& aPaint)
|
2010-09-15 14:03:13 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mPaints.push_back(aPaint);
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void AddNoSwapPaint(const CompositableOperation& aPaint)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mPaints.push_back(Edit(aPaint));
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
void AddMutant(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
|
|
|
|
mMutants.insert(aLayer);
|
|
|
|
}
|
|
|
|
void End()
|
|
|
|
{
|
|
|
|
mCset.clear();
|
2010-09-15 14:03:13 -07:00
|
|
|
mPaints.clear();
|
2010-07-21 14:17:33 -07:00
|
|
|
mMutants.clear();
|
2011-10-17 07:59:28 -07:00
|
|
|
mOpen = false;
|
2012-05-01 12:23:39 -07:00
|
|
|
mSwapRequired = false;
|
2012-11-06 01:11:43 -08:00
|
|
|
mRotationChanged = false;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Empty() const {
|
2010-09-15 14:03:13 -07:00
|
|
|
return mCset.empty() && mPaints.empty() && mMutants.empty();
|
|
|
|
}
|
2012-11-06 01:11:43 -08:00
|
|
|
bool RotationChanged() const {
|
|
|
|
return mRotationChanged;
|
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool Finished() const { return !mOpen && Empty(); }
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
EditVector mCset;
|
2010-09-15 14:03:13 -07:00
|
|
|
EditVector mPaints;
|
2010-07-21 14:17:33 -07:00
|
|
|
ShadowableLayerSet mMutants;
|
2012-07-24 12:01:09 -07:00
|
|
|
nsIntRect mTargetBounds;
|
|
|
|
ScreenRotation mTargetRotation;
|
2012-11-21 18:40:57 -08:00
|
|
|
nsIntRect mClientBounds;
|
|
|
|
ScreenOrientation mTargetOrientation;
|
2012-05-01 12:23:39 -07:00
|
|
|
bool mSwapRequired;
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
private:
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mOpen;
|
2012-11-06 01:11:43 -08:00
|
|
|
bool mRotationChanged;
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
// disabled
|
|
|
|
Transaction(const Transaction&);
|
|
|
|
Transaction& operator=(const Transaction&);
|
|
|
|
};
|
|
|
|
struct AutoTxnEnd {
|
|
|
|
AutoTxnEnd(Transaction* aTxn) : mTxn(aTxn) {}
|
|
|
|
~AutoTxnEnd() { mTxn->End(); }
|
|
|
|
Transaction* mTxn;
|
|
|
|
};
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void
|
|
|
|
CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier)
|
|
|
|
{
|
2013-07-11 19:32:09 -07:00
|
|
|
mTextureFactoryIdentifier = aIdentifier;
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2010-12-30 23:40:19 -08:00
|
|
|
ShadowLayerForwarder::ShadowLayerForwarder()
|
2014-04-25 19:34:06 -07:00
|
|
|
: mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
|
2012-03-12 08:50:15 -07:00
|
|
|
, mIsFirstPaint(false)
|
2013-06-20 06:01:20 -07:00
|
|
|
, mWindowOverlayChanged(false)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
mTxn = new Transaction();
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayerForwarder::~ShadowLayerForwarder()
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(mTxn->Finished(), "unfinished transaction?");
|
|
|
|
delete mTxn;
|
2014-05-05 18:56:40 -07:00
|
|
|
if (mShadowManager) {
|
|
|
|
mShadowManager->SetForwarder(nullptr);
|
2014-05-07 06:23:14 -07:00
|
|
|
mShadowManager->Destroy();
|
2014-05-05 18:56:40 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-07-24 12:01:09 -07:00
|
|
|
ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds,
|
2012-11-21 18:40:57 -08:00
|
|
|
ScreenRotation aRotation,
|
|
|
|
const nsIntRect& aClientBounds,
|
|
|
|
ScreenOrientation aOrientation)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
|
|
|
NS_ABORT_IF_FALSE(mTxn->Finished(), "uncommitted txn?");
|
2012-11-21 18:40:57 -08:00
|
|
|
mTxn->Begin(aTargetBounds, aRotation, aClientBounds, aOrientation);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static PLayerChild*
|
|
|
|
Shadow(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
return aLayer->GetShadow();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename OpCreateT>
|
|
|
|
static void
|
|
|
|
CreatedLayer(Transaction* aTxn, ShadowableLayer* aLayer)
|
|
|
|
{
|
2013-07-20 01:48:55 -07:00
|
|
|
aTxn->AddEdit(OpCreateT(nullptr, Shadow(aLayer)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedThebesLayer(ShadowableLayer* aThebes)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateThebesLayer>(mTxn, aThebes);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedContainerLayer(ShadowableLayer* aContainer)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateContainerLayer>(mTxn, aContainer);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedImageLayer(ShadowableLayer* aImage)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateImageLayer>(mTxn, aImage);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedColorLayer(ShadowableLayer* aColor)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateColorLayer>(mTxn, aColor);
|
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedCanvasLayer(ShadowableLayer* aCanvas)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateCanvasLayer>(mTxn, aCanvas);
|
|
|
|
}
|
2012-07-17 16:59:45 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedRefLayer(ShadowableLayer* aRef)
|
|
|
|
{
|
|
|
|
CreatedLayer<OpCreateRefLayer>(mTxn, aRef);
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-02 20:05:01 -07:00
|
|
|
void
|
2010-07-21 14:17:33 -07:00
|
|
|
ShadowLayerForwarder::Mutated(ShadowableLayer* aMutant)
|
|
|
|
{
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mTxn->AddMutant(aMutant);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::SetRoot(ShadowableLayer* aRoot)
|
|
|
|
{
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpSetRoot(nullptr, Shadow(aRoot)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::InsertAfter(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
|
|
|
if (aAfter)
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpInsertAfter(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2010-07-21 14:17:33 -07:00
|
|
|
else
|
2014-02-24 06:41:55 -08:00
|
|
|
mTxn->AddEdit(OpPrependChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild)
|
|
|
|
{
|
2013-03-21 19:17:28 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRemoveChild container=%p child=%p\n",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRemoveChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RepositionChild(ShadowableLayer* aContainer,
|
|
|
|
ShadowableLayer* aChild,
|
|
|
|
ShadowableLayer* aAfter)
|
|
|
|
{
|
2013-03-21 19:17:28 -07:00
|
|
|
if (aAfter) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRepositionChild container=%p child=%p after=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer(), aAfter->AsLayer()));
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRepositionChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild),
|
|
|
|
nullptr, Shadow(aAfter)));
|
2013-03-21 19:17:28 -07:00
|
|
|
} else {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpRaiseToTopChild container=%p child=%p",
|
|
|
|
aContainer->AsLayer(), aChild->AsLayer()));
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpRaiseToTopChild(nullptr, Shadow(aContainer),
|
|
|
|
nullptr, Shadow(aChild)));
|
2013-03-21 19:17:28 -07:00
|
|
|
}
|
2012-08-29 03:52:55 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-10-21 07:23:42 -07:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CheckSurfaceDescriptor(const SurfaceDescriptor* aDescriptor) const
|
|
|
|
{
|
|
|
|
if (!aDescriptor) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-04-06 18:32:49 -07:00
|
|
|
if (aDescriptor->type() == SurfaceDescriptor::TSurfaceDescriptorShmem) {
|
|
|
|
const SurfaceDescriptorShmem& shmem = aDescriptor->get_SurfaceDescriptorShmem();
|
|
|
|
shmem.data().AssertInvariants();
|
2013-10-31 23:36:02 -07:00
|
|
|
MOZ_ASSERT(mShadowManager &&
|
2014-04-06 18:32:49 -07:00
|
|
|
mShadowManager->IsTrackingSharedMemory(shmem.data().mSegment));
|
2013-10-21 07:23:42 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-04-13 08:17:39 -07:00
|
|
|
void
|
2014-03-07 13:34:04 -08:00
|
|
|
ShadowLayerForwarder::UseTiledLayerBuffer(CompositableClient* aCompositable,
|
|
|
|
const SurfaceDescriptorTiles& aTileLayerDescriptor)
|
2012-04-13 08:17:39 -07:00
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
2014-03-07 13:34:04 -08:00
|
|
|
mTxn->AddNoSwapPaint(OpUseTiledLayerBuffer(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTileLayerDescriptor));
|
2012-04-13 08:17:39 -07:00
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
void
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable,
|
|
|
|
const ThebesBufferData& aThebesBufferData,
|
|
|
|
const nsIntRegion& aUpdatedRegion)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddPaint(OpPaintTextureRegion(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aThebesBufferData,
|
|
|
|
aUpdatedRegion));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UpdateTextureIncremental(CompositableClient* aCompositable,
|
|
|
|
TextureIdentifier aTextureId,
|
|
|
|
SurfaceDescriptor& aDescriptor,
|
|
|
|
const nsIntRegion& aUpdatedRegion,
|
|
|
|
const nsIntRect& aBufferRect,
|
|
|
|
const nsIntPoint& aBufferRotation)
|
|
|
|
{
|
2013-10-21 07:23:42 -07:00
|
|
|
CheckSurfaceDescriptor(&aDescriptor);
|
2013-05-15 20:45:43 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
2013-05-21 20:36:38 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpPaintTextureIncremental(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTextureId,
|
|
|
|
aDescriptor,
|
|
|
|
aUpdatedRegion,
|
|
|
|
aBufferRect,
|
|
|
|
aBufferRotation));
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-22 12:22:20 -07:00
|
|
|
void
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable,
|
|
|
|
const nsIntRect& aRect)
|
2013-03-22 12:22:20 -07:00
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpUpdatePictureRect(nullptr, aCompositable->GetIPDLActor(), aRect));
|
2013-03-22 12:22:20 -07:00
|
|
|
}
|
|
|
|
|
2013-07-30 02:59:51 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UpdatedTexture(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture,
|
|
|
|
nsIntRegion* aRegion)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTexture->GetIPDLActor());
|
2013-07-30 02:59:51 -07:00
|
|
|
MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
|
|
|
|
: MaybeRegion(null_t());
|
2014-04-25 19:34:05 -07:00
|
|
|
if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
|
2013-08-03 10:30:28 -07:00
|
|
|
mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
|
2013-12-11 17:44:44 -08:00
|
|
|
nullptr, aTexture->GetIPDLActor(),
|
2013-08-03 10:30:28 -07:00
|
|
|
region));
|
|
|
|
} else {
|
|
|
|
mTxn->AddNoSwapPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
|
2013-12-11 17:44:44 -08:00
|
|
|
nullptr, aTexture->GetIPDLActor(),
|
2013-08-03 10:30:28 -07:00
|
|
|
region));
|
|
|
|
}
|
2013-07-30 02:59:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTexture->GetIPDLActor());
|
2013-07-30 02:59:51 -07:00
|
|
|
mTxn->AddEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
|
2013-12-11 17:44:44 -08:00
|
|
|
nullptr, aTexture->GetIPDLActor()));
|
2013-12-11 10:05:11 -08:00
|
|
|
}
|
|
|
|
|
2014-02-06 03:28:29 -08:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::UseComponentAlphaTextures(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTextureOnBlack,
|
|
|
|
TextureClient* aTextureOnWhite)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTextureOnWhite);
|
|
|
|
MOZ_ASSERT(aTextureOnBlack);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTextureOnBlack->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTextureOnWhite->GetIPDLActor());
|
2014-03-21 10:03:20 -07:00
|
|
|
MOZ_ASSERT(aTextureOnBlack->GetSize() == aTextureOnWhite->GetSize());
|
2014-02-06 03:28:29 -08:00
|
|
|
mTxn->AddEdit(OpUseComponentAlphaTextures(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTextureOnBlack->GetIPDLActor(),
|
|
|
|
nullptr, aTextureOnWhite->GetIPDLActor()));
|
|
|
|
}
|
|
|
|
|
2014-02-10 12:52:35 -08:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTextureFromCompositable(CompositableClient* aCompositable,
|
|
|
|
TextureClient* aTexture)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aTexture);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
MOZ_ASSERT(aTexture->GetIPDLActor());
|
2014-02-10 12:52:35 -08:00
|
|
|
mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
nullptr, aTexture->GetIPDLActor()));
|
2014-04-25 19:34:05 -07:00
|
|
|
if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
2014-02-10 12:52:35 -08:00
|
|
|
mTxn->MarkSyncTransaction();
|
|
|
|
}
|
|
|
|
// Hold texture until transaction complete.
|
|
|
|
HoldUntilTransaction(aTexture);
|
|
|
|
}
|
|
|
|
|
2013-12-11 17:44:45 -08:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aTexture);
|
2013-12-11 17:44:45 -08:00
|
|
|
aTexture->ForceRemove();
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2014-03-27 20:38:32 -07:00
|
|
|
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
|
|
|
const nsIntRegion& aRegionToClear,
|
|
|
|
bool aScheduleComposite,
|
2014-05-06 14:26:13 -07:00
|
|
|
uint32_t aPaintSequenceNumber,
|
2014-03-27 20:38:32 -07:00
|
|
|
bool* aSent)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-10-21 13:14:47 -07:00
|
|
|
*aSent = false;
|
|
|
|
|
2013-03-15 21:47:02 -07:00
|
|
|
PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation");
|
2012-02-28 08:24:24 -08:00
|
|
|
RenderTraceScope rendertrace("Foward Transaction", "000091");
|
2010-07-21 14:17:33 -07:00
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
|
|
|
NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?");
|
|
|
|
|
2013-08-02 15:50:17 -07:00
|
|
|
DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes();
|
|
|
|
if (mDiagnosticTypes != diagnostics) {
|
|
|
|
mDiagnosticTypes = diagnostics;
|
|
|
|
mTxn->AddEdit(OpSetDiagnosticTypes(diagnostics));
|
2013-03-21 10:08:01 -07:00
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
AutoTxnEnd _(mTxn);
|
|
|
|
|
2013-06-20 06:01:20 -07:00
|
|
|
if (mTxn->Empty() && !mTxn->RotationChanged() && !mWindowOverlayChanged) {
|
2012-11-06 01:11:43 -08:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?) and no rotation event, skipping Update()"));
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] destroying buffers..."));
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] building transaction..."));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-15 14:03:13 -07:00
|
|
|
// We purposely add attribute-change ops to the final changeset
|
|
|
|
// before we add paint ops. This allows layers to record the
|
|
|
|
// attribute changes before new pixels arrive, which can be useful
|
|
|
|
// for setting up back/front buffers.
|
2012-02-28 08:24:24 -08:00
|
|
|
RenderTraceScope rendertrace2("Foward Transaction", "000092");
|
2010-07-21 14:17:33 -07:00
|
|
|
for (ShadowableLayerSet::const_iterator it = mTxn->mMutants.begin();
|
|
|
|
it != mTxn->mMutants.end(); ++it) {
|
|
|
|
ShadowableLayer* shadow = *it;
|
|
|
|
Layer* mutant = shadow->AsLayer();
|
|
|
|
NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?");
|
|
|
|
|
|
|
|
LayerAttributes attrs;
|
|
|
|
CommonLayerAttributes& common = attrs.common();
|
|
|
|
common.visibleRegion() = mutant->GetVisibleRegion();
|
2013-12-16 02:47:06 -08:00
|
|
|
common.eventRegions() = mutant->GetEventRegions();
|
2012-08-03 14:29:22 -07:00
|
|
|
common.postXScale() = mutant->GetPostXScale();
|
|
|
|
common.postYScale() = mutant->GetPostYScale();
|
2012-07-30 19:20:00 -07:00
|
|
|
common.transform() = mutant->GetBaseTransform();
|
2010-09-02 02:18:40 -07:00
|
|
|
common.contentFlags() = mutant->GetContentFlags();
|
2010-07-21 14:17:33 -07:00
|
|
|
common.opacity() = mutant->GetOpacity();
|
|
|
|
common.useClipRect() = !!mutant->GetClipRect();
|
|
|
|
common.clipRect() = (common.useClipRect() ?
|
|
|
|
*mutant->GetClipRect() : nsIntRect());
|
2011-04-05 22:00:25 -07:00
|
|
|
common.isFixedPosition() = mutant->GetIsFixedPosition();
|
2012-06-27 08:43:57 -07:00
|
|
|
common.fixedPositionAnchor() = mutant->GetFixedPositionAnchor();
|
2013-04-12 15:41:18 -07:00
|
|
|
common.fixedPositionMargin() = mutant->GetFixedPositionMargins();
|
2013-09-11 21:17:58 -07:00
|
|
|
common.isStickyPosition() = mutant->GetIsStickyPosition();
|
|
|
|
if (mutant->GetIsStickyPosition()) {
|
|
|
|
common.stickyScrollContainerId() = mutant->GetStickyScrollContainerId();
|
|
|
|
common.stickyScrollRangeOuter() = mutant->GetStickyScrollRangeOuter();
|
|
|
|
common.stickyScrollRangeInner() = mutant->GetStickyScrollRangeInner();
|
|
|
|
}
|
2013-12-12 10:34:50 -08:00
|
|
|
common.scrollbarTargetContainerId() = mutant->GetScrollbarTargetContainerId();
|
|
|
|
common.scrollbarDirection() = mutant->GetScrollbarDirection();
|
2014-05-09 02:41:56 -07:00
|
|
|
common.mixBlendMode() = (int8_t)mutant->GetMixBlendMode();
|
|
|
|
common.forceIsolatedGroup() = mutant->GetForceIsolatedGroup();
|
2012-03-18 16:02:38 -07:00
|
|
|
if (Layer* maskLayer = mutant->GetMaskLayer()) {
|
|
|
|
common.maskLayerChild() = Shadow(maskLayer->AsShadowableLayer());
|
|
|
|
} else {
|
2013-07-20 01:48:55 -07:00
|
|
|
common.maskLayerChild() = nullptr;
|
2012-03-18 16:02:38 -07:00
|
|
|
}
|
2013-07-20 01:48:55 -07:00
|
|
|
common.maskLayerParent() = nullptr;
|
2012-07-31 10:28:20 -07:00
|
|
|
common.animations() = mutant->GetAnimations();
|
2013-11-21 11:25:16 -08:00
|
|
|
common.invalidRegion() = mutant->GetInvalidRegion();
|
2010-07-21 14:17:33 -07:00
|
|
|
attrs.specific() = null_t();
|
|
|
|
mutant->FillSpecificAttributes(attrs.specific());
|
|
|
|
|
2013-03-21 19:17:28 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] OpSetLayerAttributes(%p)\n", mutant));
|
|
|
|
|
2013-07-20 01:48:55 -07:00
|
|
|
mTxn->AddEdit(OpSetLayerAttributes(nullptr, Shadow(shadow), attrs));
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
AutoInfallibleTArray<Edit, 10> cset;
|
2010-09-15 14:03:13 -07:00
|
|
|
size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
|
2013-06-20 06:01:20 -07:00
|
|
|
NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged, "should have bailed by now");
|
2010-09-15 14:03:13 -07:00
|
|
|
|
|
|
|
cset.SetCapacity(nCsets);
|
2010-09-20 12:40:30 -07:00
|
|
|
if (!mTxn->mCset.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size());
|
|
|
|
}
|
2010-09-15 14:03:13 -07:00
|
|
|
// Paints after non-paint ops, including attribute changes. See
|
|
|
|
// above.
|
2010-09-20 12:40:30 -07:00
|
|
|
if (!mTxn->mPaints.empty()) {
|
|
|
|
cset.AppendElements(&mTxn->mPaints.front(), mTxn->mPaints.size());
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2013-06-20 06:01:20 -07:00
|
|
|
mWindowOverlayChanged = false;
|
|
|
|
|
2014-03-27 20:38:32 -07:00
|
|
|
TargetConfig targetConfig(mTxn->mTargetBounds,
|
|
|
|
mTxn->mTargetRotation,
|
|
|
|
mTxn->mClientBounds,
|
|
|
|
mTxn->mTargetOrientation,
|
|
|
|
aRegionToClear);
|
2012-07-24 12:01:09 -07:00
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
|
|
|
|
PlatformSyncBeforeUpdate();
|
|
|
|
|
2013-09-27 09:08:45 -07:00
|
|
|
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END);
|
2012-05-01 12:23:39 -07:00
|
|
|
if (mTxn->mSwapRequired) {
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
|
|
|
|
RenderTraceScope rendertrace3("Forward Transaction", "000093");
|
2013-10-31 23:36:02 -07:00
|
|
|
if (!HasShadowManager() ||
|
2014-04-15 18:59:09 -07:00
|
|
|
!mShadowManager->IPCOpen() ||
|
2013-10-31 23:36:02 -07:00
|
|
|
!mShadowManager->SendUpdate(cset, targetConfig, mIsFirstPaint,
|
2014-05-06 14:26:13 -07:00
|
|
|
aScheduleComposite, aPaintSequenceNumber,
|
|
|
|
aReplies)) {
|
2012-05-01 12:23:39 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// If we don't require a swap we can call SendUpdateNoSwap which
|
|
|
|
// assumes that aReplies is empty (DEBUG assertion)
|
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] sending no swap transaction..."));
|
|
|
|
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
|
2013-10-31 23:36:02 -07:00
|
|
|
if (!HasShadowManager() ||
|
2014-04-15 18:59:09 -07:00
|
|
|
!mShadowManager->IPCOpen() ||
|
2014-05-06 14:26:13 -07:00
|
|
|
!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint,
|
|
|
|
aPaintSequenceNumber, aScheduleComposite)) {
|
2012-05-01 12:23:39 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
|
|
|
return false;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2013-10-21 13:14:47 -07:00
|
|
|
*aSent = true;
|
2012-03-12 08:50:15 -07:00
|
|
|
mIsFirstPaint = false;
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
|
2011-10-17 07:59:28 -07:00
|
|
|
return true;
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::AllocShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2013-10-31 23:36:02 -07:00
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager");
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return false;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
return mShadowManager->AllocShmem(aSize, aType, aShmem);
|
2010-07-21 14:17:33 -07:00
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
ShadowLayerForwarder::AllocUnsafeShmem(size_t aSize,
|
|
|
|
ipc::SharedMemory::SharedMemoryType aType,
|
|
|
|
ipc::Shmem* aShmem)
|
2012-07-12 05:51:57 -07:00
|
|
|
{
|
2013-10-31 23:36:02 -07:00
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager");
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return false;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
return mShadowManager->AllocUnsafeShmem(aSize, aType, aShmem);
|
2012-07-12 05:51:57 -07:00
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::DeallocShmem(ipc::Shmem& aShmem)
|
|
|
|
{
|
2013-10-31 23:36:02 -07:00
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager");
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return;
|
|
|
|
}
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
mShadowManager->DeallocShmem(aShmem);
|
2010-12-30 23:40:31 -08:00
|
|
|
}
|
|
|
|
|
2013-11-27 07:18:38 -08:00
|
|
|
bool
|
|
|
|
ShadowLayerForwarder::IPCOpen() const
|
|
|
|
{
|
|
|
|
return mShadowManager->IPCOpen();
|
|
|
|
}
|
|
|
|
|
2014-02-25 05:12:49 -08:00
|
|
|
bool
|
|
|
|
ShadowLayerForwarder::IsSameProcess() const
|
|
|
|
{
|
2014-04-15 18:59:09 -07:00
|
|
|
if (!mShadowManager->IPCOpen()) {
|
|
|
|
return false;
|
|
|
|
}
|
2014-02-25 05:12:49 -08:00
|
|
|
return mShadowManager->OtherProcess() == kInvalidProcessHandle;
|
|
|
|
}
|
|
|
|
|
2013-10-31 23:36:02 -07:00
|
|
|
/**
|
|
|
|
* We bail out when we have no shadow manager. That can happen when the
|
|
|
|
* layer manager is created by the preallocated process.
|
|
|
|
* See bug 914843 for details.
|
|
|
|
*/
|
2010-07-21 14:17:33 -07:00
|
|
|
PLayerChild*
|
|
|
|
ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return nullptr;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
return mShadowManager->SendPLayerConstructor(new ShadowLayerChild(aLayer));
|
|
|
|
}
|
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
#if !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
|
|
|
/*static*/ void
|
|
|
|
ShadowLayerForwarder::PlatformSyncBeforeUpdate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // !defined(MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS)
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::Connect(CompositableClient* aCompositable)
|
|
|
|
{
|
|
|
|
#ifdef GFX_COMPOSITOR_LOGGING
|
|
|
|
printf("ShadowLayerForwarder::Connect(Compositable)\n");
|
|
|
|
#endif
|
|
|
|
MOZ_ASSERT(aCompositable);
|
2013-10-31 23:36:02 -07:00
|
|
|
MOZ_ASSERT(mShadowManager);
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return;
|
|
|
|
}
|
2014-04-24 11:13:59 -07:00
|
|
|
PCompositableChild* actor =
|
|
|
|
mShadowManager->SendPCompositableConstructor(aCompositable->GetTextureInfo());
|
|
|
|
MOZ_ASSERT(actor);
|
|
|
|
aCompositable->InitIPDLActor(actor);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
}
|
|
|
|
|
2013-05-15 20:45:43 -07:00
|
|
|
void
|
|
|
|
ShadowLayerForwarder::CreatedIncrementalBuffer(CompositableClient* aCompositable,
|
|
|
|
const TextureInfo& aTextureInfo,
|
|
|
|
const nsIntRect& aBufferRect)
|
|
|
|
{
|
2014-04-11 09:47:56 -07:00
|
|
|
MOZ_ASSERT(aCompositable);
|
2013-05-21 20:36:38 -07:00
|
|
|
mTxn->AddNoSwapPaint(OpCreatedIncrementalTexture(nullptr, aCompositable->GetIPDLActor(),
|
|
|
|
aTextureInfo, aBufferRect));
|
2013-05-15 20:45:43 -07:00
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 02:20:52 -07:00
|
|
|
void ShadowLayerForwarder::Attach(CompositableClient* aCompositable,
|
|
|
|
ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aLayer);
|
|
|
|
MOZ_ASSERT(aCompositable);
|
|
|
|
MOZ_ASSERT(aCompositable->GetIPDLActor());
|
|
|
|
mTxn->AddEdit(OpAttachCompositable(nullptr, Shadow(aLayer),
|
|
|
|
nullptr, aCompositable->GetIPDLActor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::AttachAsyncCompositable(uint64_t aCompositableID,
|
|
|
|
ShadowableLayer* aLayer)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aLayer);
|
|
|
|
MOZ_ASSERT(aCompositableID != 0); // zero is always an invalid compositable id.
|
|
|
|
mTxn->AddEdit(OpAttachAsyncCompositable(nullptr, Shadow(aLayer),
|
|
|
|
aCompositableID));
|
|
|
|
}
|
2012-07-12 05:51:58 -07:00
|
|
|
|
2013-12-11 17:44:44 -08:00
|
|
|
PTextureChild*
|
2014-01-21 14:06:18 -08:00
|
|
|
ShadowLayerForwarder::CreateTexture(const SurfaceDescriptor& aSharedData,
|
|
|
|
TextureFlags aFlags)
|
2013-12-11 17:44:44 -08:00
|
|
|
{
|
2014-05-05 18:56:40 -07:00
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
2014-04-15 18:59:09 -07:00
|
|
|
return nullptr;
|
|
|
|
}
|
2014-01-21 14:06:18 -08:00
|
|
|
return mShadowManager->SendPTextureConstructor(aSharedData, aFlags);
|
2013-12-11 17:44:44 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-27 07:19:34 -08:00
|
|
|
void ShadowLayerForwarder::SetShadowManager(PLayerTransactionChild* aShadowManager)
|
|
|
|
{
|
|
|
|
mShadowManager = static_cast<LayerTransactionChild*>(aShadowManager);
|
2014-05-05 18:56:40 -07:00
|
|
|
mShadowManager->SetForwarder(this);
|
2013-11-27 07:19:34 -08:00
|
|
|
}
|
|
|
|
|
2014-05-05 18:56:40 -07:00
|
|
|
void ShadowLayerForwarder::StopReceiveAsyncParentMessge()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SendPendingAsyncMessge();
|
|
|
|
mShadowManager->SetForwarder(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::ClearCachedResources()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SendPendingAsyncMessge();
|
|
|
|
mShadowManager->SendClearCachedResources();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::Composite()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mShadowManager->SendForceComposite();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShadowLayerForwarder::SendPendingAsyncMessge()
|
|
|
|
{
|
|
|
|
if (!HasShadowManager() ||
|
|
|
|
!mShadowManager->IPCOpen() ||
|
|
|
|
mTransactionsToRespond.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Send OpReplyDeliverFence messages
|
|
|
|
InfallibleTArray<AsyncChildMessageData> replies;
|
|
|
|
replies.SetCapacity(mTransactionsToRespond.size());
|
|
|
|
for (size_t i = 0; i < mTransactionsToRespond.size(); i++) {
|
|
|
|
replies.AppendElement(OpReplyDeliverFence(mTransactionsToRespond[i]));
|
|
|
|
}
|
|
|
|
mTransactionsToRespond.clear();
|
|
|
|
mShadowManager->SendChildAsyncMessages(replies);
|
|
|
|
}
|
2013-11-27 07:19:34 -08:00
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|