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 <vector>
|
|
|
|
|
|
|
|
#include "ShadowLayersParent.h"
|
|
|
|
#include "ShadowLayerParent.h"
|
|
|
|
#include "ShadowLayers.h"
|
2012-02-17 14:05:03 -08:00
|
|
|
#include "RenderTrace.h"
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
#include "mozilla/unused.h"
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
#include "mozilla/layout/RenderFrameParent.h"
|
2011-12-19 10:17:29 -08:00
|
|
|
#include "CompositorParent.h"
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
#include "gfxSharedImageSurface.h"
|
|
|
|
|
2012-04-13 08:17:39 -07:00
|
|
|
#include "TiledLayerBuffer.h"
|
2010-07-21 14:17:33 -07:00
|
|
|
#include "ImageLayers.h"
|
|
|
|
|
|
|
|
typedef std::vector<mozilla::layers::EditReply> EditReplyVector;
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
using mozilla::layout::RenderFrameParent;
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
|
|
|
//--------------------------------------------------
|
|
|
|
// Convenience accessors
|
|
|
|
static ShadowLayerParent*
|
|
|
|
cast(const PLayerParent* in)
|
|
|
|
{
|
|
|
|
return const_cast<ShadowLayerParent*>(
|
|
|
|
static_cast<const ShadowLayerParent*>(in));
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class OpCreateT>
|
|
|
|
static ShadowLayerParent*
|
|
|
|
AsShadowLayer(const OpCreateT& op)
|
|
|
|
{
|
|
|
|
return cast(op.layerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
AsShadowLayer(const OpSetRoot& op)
|
|
|
|
{
|
|
|
|
return cast(op.rootParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowAfter(const OpInsertAfter& op)
|
|
|
|
{
|
|
|
|
return cast(op.afterParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpAppendChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpAppendChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowContainer(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.containerParent());
|
|
|
|
}
|
|
|
|
static ShadowLayerParent*
|
|
|
|
ShadowChild(const OpRemoveChild& op)
|
|
|
|
{
|
|
|
|
return cast(op.childLayerParent());
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------
|
|
|
|
// ShadowLayersParent
|
2012-01-06 14:52:32 -08:00
|
|
|
ShadowLayersParent::ShadowLayersParent(ShadowLayerManager* aManager,
|
|
|
|
ShadowLayersManager* aLayersManager)
|
|
|
|
: mLayerManager(aManager), mShadowLayersManager(aLayersManager), mDestroyed(false)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ShadowLayersParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
ShadowLayersParent::~ShadowLayersParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(ShadowLayersParent);
|
|
|
|
}
|
|
|
|
|
2011-01-05 20:54:47 -08:00
|
|
|
void
|
|
|
|
ShadowLayersParent::Destroy()
|
|
|
|
{
|
2011-01-12 12:13:41 -08:00
|
|
|
mDestroyed = true;
|
2011-01-05 20:54:47 -08:00
|
|
|
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
|
|
|
|
ShadowLayerParent* slp =
|
|
|
|
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
|
|
|
|
slp->Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-01 12:23:39 -07:00
|
|
|
/* virtual */
|
|
|
|
bool
|
|
|
|
ShadowLayersParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
|
|
|
const bool& isFirstPaint)
|
|
|
|
{
|
|
|
|
InfallibleTArray<EditReply> noReplies;
|
|
|
|
bool success = RecvUpdate(cset, isFirstPaint, &noReplies);
|
|
|
|
NS_ABORT_IF_FALSE(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits");
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
bool
|
2010-11-08 18:49:00 -08:00
|
|
|
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
2012-03-12 08:50:07 -07:00
|
|
|
const bool& isFirstPaint,
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<EditReply>* reply)
|
2010-07-21 14:17:33 -07:00
|
|
|
{
|
2012-02-10 15:06:17 -08:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
|
|
|
TimeStamp updateStart = TimeStamp::Now();
|
|
|
|
#endif
|
|
|
|
|
2011-05-31 09:14:54 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] received txn with %d edits", cset.Length()));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2011-01-12 12:13:41 -08:00
|
|
|
if (mDestroyed || layer_manager()->IsDestroyed()) {
|
2010-12-27 06:48:00 -08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
EditReplyVector replyv;
|
|
|
|
|
|
|
|
layer_manager()->BeginTransactionWithTarget(NULL);
|
|
|
|
|
|
|
|
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
|
|
|
|
const Edit& edit = cset[i];
|
|
|
|
|
|
|
|
switch (edit.type()) {
|
|
|
|
// Create* ops
|
|
|
|
case Edit::TOpCreateThebesLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
|
|
|
|
|
2010-09-24 15:41:31 -07:00
|
|
|
nsRefPtr<ShadowThebesLayer> layer =
|
|
|
|
layer_manager()->CreateShadowThebesLayer();
|
2010-10-13 15:55:45 -07:00
|
|
|
layer->SetAllocator(this);
|
2010-07-21 14:17:33 -07:00
|
|
|
AsShadowLayer(edit.get_OpCreateThebesLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateContainerLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
|
|
|
|
|
2010-10-13 15:55:45 -07:00
|
|
|
nsRefPtr<ContainerLayer> layer = layer_manager()->CreateShadowContainerLayer();
|
2010-07-21 14:17:33 -07:00
|
|
|
AsShadowLayer(edit.get_OpCreateContainerLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateImageLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateImageLayer"));
|
|
|
|
|
2010-09-24 15:41:31 -07:00
|
|
|
nsRefPtr<ShadowImageLayer> layer =
|
|
|
|
layer_manager()->CreateShadowImageLayer();
|
|
|
|
AsShadowLayer(edit.get_OpCreateImageLayer())->Bind(layer);
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateColorLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateColorLayer"));
|
|
|
|
|
2010-10-13 15:55:45 -07:00
|
|
|
nsRefPtr<ShadowColorLayer> layer = layer_manager()->CreateShadowColorLayer();
|
2010-07-21 14:17:33 -07:00
|
|
|
AsShadowLayer(edit.get_OpCreateColorLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpCreateCanvasLayer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] CreateCanvasLayer"));
|
|
|
|
|
2010-09-24 15:41:31 -07:00
|
|
|
nsRefPtr<ShadowCanvasLayer> layer =
|
|
|
|
layer_manager()->CreateShadowCanvasLayer();
|
2010-10-13 15:55:45 -07:00
|
|
|
layer->SetAllocator(this);
|
2010-07-21 14:17:33 -07:00
|
|
|
AsShadowLayer(edit.get_OpCreateCanvasLayer())->Bind(layer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Attributes
|
|
|
|
case Edit::TOpSetLayerAttributes: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetLayerAttributes"));
|
|
|
|
|
|
|
|
const OpSetLayerAttributes& osla = edit.get_OpSetLayerAttributes();
|
|
|
|
Layer* layer = AsShadowLayer(osla)->AsLayer();
|
|
|
|
const LayerAttributes& attrs = osla.attrs();
|
|
|
|
|
|
|
|
const CommonLayerAttributes& common = attrs.common();
|
|
|
|
layer->SetVisibleRegion(common.visibleRegion());
|
2010-09-02 02:18:40 -07:00
|
|
|
layer->SetContentFlags(common.contentFlags());
|
2010-07-21 14:17:33 -07:00
|
|
|
layer->SetOpacity(common.opacity());
|
|
|
|
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
|
|
|
|
layer->SetTransform(common.transform());
|
2011-05-12 09:49:33 -07:00
|
|
|
static bool fixedPositionLayersEnabled = getenv("MOZ_ENABLE_FIXED_POSITION_LAYERS") != 0;
|
|
|
|
if (fixedPositionLayersEnabled) {
|
|
|
|
layer->SetIsFixedPosition(common.isFixedPosition());
|
|
|
|
}
|
2012-03-18 16:02:38 -07:00
|
|
|
if (PLayerParent* maskLayer = common.maskLayerParent()) {
|
|
|
|
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
|
|
|
|
} else {
|
|
|
|
layer->SetMaskLayer(NULL);
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
typedef SpecificLayerAttributes Specific;
|
|
|
|
const SpecificLayerAttributes& specific = attrs.specific();
|
|
|
|
switch (specific.type()) {
|
|
|
|
case Specific::Tnull_t:
|
|
|
|
break;
|
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
case Specific::TThebesLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] thebes layer"));
|
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
ShadowThebesLayer* thebesLayer =
|
|
|
|
static_cast<ShadowThebesLayer*>(layer);
|
|
|
|
const ThebesLayerAttributes& attrs =
|
|
|
|
specific.get_ThebesLayerAttributes();
|
|
|
|
|
|
|
|
thebesLayer->SetValidRegion(attrs.validRegion());
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-03 13:10:46 -07:00
|
|
|
break;
|
|
|
|
}
|
2010-09-03 13:10:45 -07:00
|
|
|
case Specific::TContainerLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] container layer"));
|
|
|
|
|
|
|
|
static_cast<ContainerLayer*>(layer)->SetFrameMetrics(
|
|
|
|
specific.get_ContainerLayerAttributes().metrics());
|
|
|
|
break;
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
case Specific::TColorLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] color layer"));
|
|
|
|
|
|
|
|
static_cast<ColorLayer*>(layer)->SetColor(
|
|
|
|
specific.get_ColorLayerAttributes().color());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Specific::TCanvasLayerAttributes:
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] canvas layer"));
|
|
|
|
|
|
|
|
static_cast<CanvasLayer*>(layer)->SetFilter(
|
|
|
|
specific.get_CanvasLayerAttributes().filter());
|
|
|
|
break;
|
|
|
|
|
2012-05-22 16:14:03 -07:00
|
|
|
case Specific::TImageLayerAttributes: {
|
2010-07-21 14:17:33 -07:00
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] image layer"));
|
|
|
|
|
2012-05-22 16:14:03 -07:00
|
|
|
ImageLayer* imageLayer = static_cast<ImageLayer*>(layer);
|
|
|
|
const ImageLayerAttributes& attrs = specific.get_ImageLayerAttributes();
|
|
|
|
imageLayer->SetFilter(attrs.filter());
|
|
|
|
imageLayer->SetForceSingleTile(attrs.forceSingleTile());
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
2012-05-22 16:14:03 -07:00
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tree ops
|
|
|
|
case Edit::TOpSetRoot: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
|
|
|
|
|
2010-09-03 13:10:45 -07:00
|
|
|
mRoot = AsShadowLayer(edit.get_OpSetRoot())->AsContainer();
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpInsertAfter: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
|
|
|
|
|
|
|
|
const OpInsertAfter& oia = edit.get_OpInsertAfter();
|
|
|
|
ShadowContainer(oia)->AsContainer()->InsertAfter(
|
|
|
|
ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpAppendChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] AppendChild"));
|
|
|
|
|
|
|
|
const OpAppendChild& oac = edit.get_OpAppendChild();
|
|
|
|
ShadowContainer(oac)->AsContainer()->InsertAfter(
|
|
|
|
ShadowChild(oac)->AsLayer(), NULL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpRemoveChild: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] RemoveChild"));
|
|
|
|
|
|
|
|
const OpRemoveChild& orc = edit.get_OpRemoveChild();
|
|
|
|
Layer* childLayer = ShadowChild(orc)->AsLayer();
|
|
|
|
ShadowContainer(orc)->AsContainer()->RemoveChild(childLayer);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-04-13 08:17:39 -07:00
|
|
|
case Edit::TOpPaintTiledLayerBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint TiledLayerBuffer"));
|
|
|
|
const OpPaintTiledLayerBuffer& op = edit.get_OpPaintTiledLayerBuffer();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
|
|
|
|
ShadowThebesLayer* shadowLayer = static_cast<ShadowThebesLayer*>(shadow->AsLayer());
|
|
|
|
TiledLayerComposer* tileComposer = shadowLayer->AsTiledLayerComposer();
|
|
|
|
|
|
|
|
NS_ASSERTION(tileComposer, "shadowLayer is not a tile composer");
|
|
|
|
|
|
|
|
BasicTiledLayerBuffer* p = (BasicTiledLayerBuffer*)op.tiledLayerBuffer();
|
|
|
|
tileComposer->PaintedTiledLayerBuffer(p);
|
|
|
|
break;
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
case Edit::TOpPaintThebesBuffer: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
|
|
|
|
|
|
|
|
const OpPaintThebesBuffer& op = edit.get_OpPaintThebesBuffer();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowThebesLayer* thebes =
|
|
|
|
static_cast<ShadowThebesLayer*>(shadow->AsLayer());
|
|
|
|
const ThebesBuffer& newFront = op.newFrontBuffer();
|
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
|
2012-02-17 14:05:03 -08:00
|
|
|
|
2011-10-10 09:47:27 -07:00
|
|
|
OptionalThebesBuffer newBack;
|
2010-09-13 22:23:08 -07:00
|
|
|
nsIntRegion newValidRegion;
|
2010-11-05 00:17:07 -07:00
|
|
|
OptionalThebesBuffer readonlyFront;
|
|
|
|
nsIntRegion frontUpdatedRegion;
|
2010-09-13 22:23:08 -07:00
|
|
|
thebes->Swap(newFront, op.updatedRegion(),
|
2011-06-22 05:11:28 -07:00
|
|
|
&newBack, &newValidRegion,
|
2010-11-05 00:17:07 -07:00
|
|
|
&readonlyFront, &frontUpdatedRegion);
|
2010-09-13 22:23:08 -07:00
|
|
|
replyv.push_back(
|
|
|
|
OpThebesBufferSwap(
|
|
|
|
shadow, NULL,
|
2011-06-22 05:11:28 -07:00
|
|
|
newBack, newValidRegion,
|
2010-11-05 00:17:07 -07:00
|
|
|
readonlyFront, frontUpdatedRegion));
|
2012-02-17 14:05:03 -08:00
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateEnd(thebes, "FF00FF");
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpPaintCanvas: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint CanvasLayer"));
|
|
|
|
|
|
|
|
const OpPaintCanvas& op = edit.get_OpPaintCanvas();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowCanvasLayer* canvas =
|
|
|
|
static_cast<ShadowCanvasLayer*>(shadow->AsLayer());
|
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateStart(canvas, "FF00FF", canvas->GetVisibleRegion().GetBounds());
|
2012-02-17 14:05:03 -08:00
|
|
|
|
2011-09-27 15:19:28 -07:00
|
|
|
canvas->SetAllocator(this);
|
|
|
|
CanvasSurface newBack;
|
|
|
|
canvas->Swap(op.newFrontBuffer(), op.needYFlip(), &newBack);
|
2011-03-27 16:59:46 -07:00
|
|
|
canvas->Updated();
|
2010-07-21 14:17:33 -07:00
|
|
|
replyv.push_back(OpBufferSwap(shadow, NULL,
|
2011-04-20 14:45:57 -07:00
|
|
|
newBack));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateEnd(canvas, "FF00FF");
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case Edit::TOpPaintImage: {
|
|
|
|
MOZ_LAYERS_LOG(("[ParentSide] Paint ImageLayer"));
|
|
|
|
|
|
|
|
const OpPaintImage& op = edit.get_OpPaintImage();
|
|
|
|
ShadowLayerParent* shadow = AsShadowLayer(op);
|
|
|
|
ShadowImageLayer* image =
|
|
|
|
static_cast<ShadowImageLayer*>(shadow->AsLayer());
|
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateStart(image, "FF00FF", image->GetVisibleRegion().GetBounds());
|
|
|
|
|
2011-09-27 15:19:26 -07:00
|
|
|
image->SetAllocator(this);
|
2011-04-20 16:21:56 -07:00
|
|
|
SharedImage newBack;
|
2011-04-20 14:45:57 -07:00
|
|
|
image->Swap(op.newFrontBuffer(), &newBack);
|
2011-04-20 21:38:39 -07:00
|
|
|
replyv.push_back(OpImageSwap(shadow, NULL,
|
|
|
|
newBack));
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2012-02-24 08:35:04 -08:00
|
|
|
RenderTraceInvalidateEnd(image, "FF00FF");
|
2010-07-21 14:17:33 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_RUNTIMEABORT("not reached");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 06:20:42 -07:00
|
|
|
layer_manager()->EndTransaction(NULL, NULL, LayerManager::END_NO_IMMEDIATE_REDRAW);
|
2010-07-21 14:17:33 -07:00
|
|
|
|
|
|
|
reply->SetCapacity(replyv.size());
|
2010-07-21 16:13:24 -07:00
|
|
|
if (replyv.size() > 0) {
|
|
|
|
reply->AppendElements(&replyv.front(), replyv.size());
|
|
|
|
}
|
2010-07-21 14:17:33 -07:00
|
|
|
|
2010-09-13 22:23:08 -07:00
|
|
|
// Ensure that any pending operations involving back and front
|
|
|
|
// buffers have completed, so that neither process stomps on the
|
|
|
|
// other's buffer contents.
|
|
|
|
ShadowLayerManager::PlatformSyncBeforeReplyUpdate();
|
|
|
|
|
2012-03-12 08:50:15 -07:00
|
|
|
mShadowLayersManager->ShadowLayersUpdated(isFirstPaint);
|
2010-08-20 16:24:41 -07:00
|
|
|
|
2012-02-10 15:06:17 -08:00
|
|
|
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
2012-03-19 04:55:37 -07:00
|
|
|
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
|
|
|
|
if (compositeTime > 15) {
|
|
|
|
printf_stderr("Compositor: Layers update took %i ms (blocking gecko).\n", compositeTime);
|
|
|
|
}
|
2012-02-10 15:06:17 -08:00
|
|
|
#endif
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-06-01 05:42:34 -07:00
|
|
|
bool
|
|
|
|
ShadowLayersParent::RecvDrawToSurface(const SurfaceDescriptor& surfaceIn,
|
|
|
|
SurfaceDescriptor* surfaceOut)
|
|
|
|
{
|
|
|
|
*surfaceOut = surfaceIn;
|
2012-06-01 05:42:36 -07:00
|
|
|
if (mDestroyed || layer_manager()->IsDestroyed()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> sharedSurface = ShadowLayerForwarder::OpenDescriptor(surfaceIn);
|
|
|
|
|
|
|
|
nsRefPtr<gfxASurface> localSurface =
|
|
|
|
gfxPlatform::GetPlatform()->CreateOffscreenSurface(sharedSurface->GetSize(),
|
|
|
|
sharedSurface->GetContentType());
|
|
|
|
nsRefPtr<gfxContext> context = new gfxContext(localSurface);
|
|
|
|
|
|
|
|
layer_manager()->BeginTransactionWithTarget(context);
|
|
|
|
layer_manager()->EndTransaction(NULL, NULL);
|
|
|
|
nsRefPtr<gfxContext> contextForCopy = new gfxContext(sharedSurface);
|
|
|
|
contextForCopy->SetOperator(gfxContext::OPERATOR_SOURCE);
|
|
|
|
contextForCopy->DrawSurface(localSurface, localSurface->GetSize());
|
2012-06-01 05:42:34 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
PLayerParent*
|
|
|
|
ShadowLayersParent::AllocPLayer()
|
|
|
|
{
|
|
|
|
return new ShadowLayerParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
ShadowLayersParent::DeallocPLayer(PLayerParent* actor)
|
|
|
|
{
|
|
|
|
delete actor;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-09-27 15:19:26 -07:00
|
|
|
void
|
|
|
|
ShadowLayersParent::DestroySharedSurface(gfxSharedImageSurface* aSurface)
|
|
|
|
{
|
|
|
|
layer_manager()->DestroySharedSurface(aSurface, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ShadowLayersParent::DestroySharedSurface(SurfaceDescriptor* aSurface)
|
|
|
|
{
|
|
|
|
layer_manager()->DestroySharedSurface(aSurface, this);
|
|
|
|
}
|
|
|
|
|
2010-07-21 14:17:33 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|