Bug 748649 - Allow layer transactions that don't require a buffer swap to be perform asynchronously. r=cjones

--HG--
extra : rebase_source : b0d11710119eb87cef8f461ece44baaba88f7477
This commit is contained in:
Benoit Girard 2012-05-01 15:23:39 -04:00
Родитель 58ff026b42
Коммит 9551b9b0e1
4 изменённых файлов: 46 добавлений и 7 удалений

Просмотреть файл

@ -244,6 +244,10 @@ parent:
sync Update(Edit[] cset, bool isFirstPaint)
returns (EditReply[] reply);
// We don't need to send a sync transaction if
// no transaction operate require a swap.
async UpdateNoSwap(Edit[] cset, bool isFirstPaint);
async __delete__();
};

Просмотреть файл

@ -66,7 +66,10 @@ typedef std::set<ShadowableLayer*> ShadowableLayerSet;
class Transaction
{
public:
Transaction() : mOpen(false) {}
Transaction()
: mOpen(false)
, mSwapRequired(false)
{}
void Begin() { mOpen = true; }
@ -76,6 +79,11 @@ public:
mCset.push_back(aEdit);
}
void AddPaint(const Edit& aPaint)
{
AddNoSwapPaint(aPaint);
mSwapRequired = true;
}
void AddNoSwapPaint(const Edit& aPaint)
{
NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?");
mPaints.push_back(aPaint);
@ -102,6 +110,7 @@ public:
mDyingBuffers.Clear();
mMutants.clear();
mOpen = false;
mSwapRequired = false;
}
bool Empty() const {
@ -113,6 +122,7 @@ public:
EditVector mPaints;
BufferArray mDyingBuffers;
ShadowableLayerSet mMutants;
bool mSwapRequired;
private:
bool mOpen;
@ -247,7 +257,7 @@ ShadowLayerForwarder::PaintedTiledLayerBuffer(ShadowableLayer* aLayer,
{
if (XRE_GetProcessType() != GeckoProcessType_Default)
NS_RUNTIMEABORT("PaintedTiledLayerBuffer must be made IPC safe (not share pointers)");
mTxn->AddPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
mTxn->AddNoSwapPaint(OpPaintTiledLayerBuffer(NULL, Shadow(aLayer),
uintptr_t(aTiledLayerBuffer)));
}
@ -341,11 +351,22 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
RenderTraceScope rendertrace3("Foward Transaction", "000093");
if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
if (mTxn->mSwapRequired) {
MOZ_LAYERS_LOG(("[LayersForwarder] sending transaction..."));
RenderTraceScope rendertrace3("Forward Transaction", "000093");
if (!mShadowManager->SendUpdate(cset, mIsFirstPaint, aReplies)) {
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");
if (!mShadowManager->SendUpdateNoSwap(cset, mIsFirstPaint)) {
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
return false;
}
}
mIsFirstPaint = false;

Просмотреть файл

@ -147,6 +147,17 @@ ShadowLayersParent::Destroy()
}
}
/* 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;
}
bool
ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const bool& isFirstPaint,

Просмотреть файл

@ -81,6 +81,9 @@ protected:
const bool& isFirstPaint,
EditReplyArray* reply);
NS_OVERRIDE virtual bool RecvUpdateNoSwap(const EditArray& cset,
const bool& isFirstPaint);
NS_OVERRIDE virtual PLayerParent* AllocPLayer();
NS_OVERRIDE virtual bool DeallocPLayer(PLayerParent* actor);