Bug 1369840 - Support content-side APZ test data in WebRenderLayerManager. r=botond

This mostly just copies the functional parts of the APZTestData code from
ClientLayerManager into WebRenderLayerManager, and propagates the paint sequence
number over to the compositor using the existing WebRenderScrollData machinery.

MozReview-Commit-ID: LHupFpqtWTX
This commit is contained in:
Kartikaya Gupta 2017-06-04 22:29:35 -04:00
Родитель 8bd2880fc4
Коммит 10f514bb72
7 изменённых файлов: 52 добавлений и 2 удалений

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

@ -3893,6 +3893,10 @@ nsDOMWindowUtils::GetContentAPZTestData(JSContext* aContext,
if (!clm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) {
return NS_ERROR_FAILURE;
}
} else if (WebRenderLayerManager* wrlm = lm->AsWebRenderLayerManager()) {
if (!wrlm->GetAPZTestData().ToJS(aOutContentTestData, aContext)) {
return NS_ERROR_FAILURE;
}
}
}

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

@ -371,7 +371,7 @@ WebRenderBridgeParent::UpdateAPZ()
if (RefPtr<APZCTreeManager> apzc = cbp->GetAPZCTreeManager()) {
apzc->UpdateHitTestingTree(rootLayersId, rootWrbp->GetScrollData(),
mScrollData.IsFirstPaint(), GetLayersId(),
/* TODO: propagate paint sequence number */ 0);
mScrollData.GetPaintSequenceNumber());
}
}

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

@ -32,6 +32,7 @@ WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
, mNeedsComposite(false)
, mIsFirstPaint(false)
, mTarget(nullptr)
, mPaintSequenceNumber(0)
{
MOZ_COUNT_CTOR(WebRenderLayerManager);
}
@ -124,6 +125,13 @@ WebRenderLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
bool
WebRenderLayerManager::BeginTransaction()
{
// Increment the paint sequence number even if test logging isn't
// enabled in this process; it may be enabled in the parent process,
// and the parent process expects unique sequence numbers.
++mPaintSequenceNumber;
if (gfxPrefs::APZTestLoggingEnabled()) {
mApzTestData.StartNewPaint(mPaintSequenceNumber);
}
return true;
}
@ -209,6 +217,7 @@ WebRenderLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback
scrollData.SetIsFirstPaint();
mIsFirstPaint = false;
}
scrollData.SetPaintSequenceNumber(mPaintSequenceNumber);
if (mRoot) {
PopulateScrollData(scrollData, mRoot.get());
}

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

@ -8,6 +8,7 @@
#include "Layers.h"
#include "mozilla/MozPromise.h"
#include "mozilla/layers/APZTestData.h"
#include "mozilla/layers/TransactionIdAllocator.h"
#include "mozilla/webrender/WebRenderTypes.h"
@ -126,6 +127,16 @@ public:
void SetTransactionIncomplete() { mTransactionIncomplete = true; }
bool IsMutatedLayer(Layer* aLayer);
// See equivalent function in ClientLayerManager
void LogTestDataForCurrentPaint(FrameMetrics::ViewID aScrollId,
const std::string& aKey,
const std::string& aValue) {
mApzTestData.LogTestDataForPaint(mPaintSequenceNumber, aScrollId, aKey, aValue);
}
// See equivalent function in ClientLayerManager
const APZTestData& GetAPZTestData() const
{ return mApzTestData; }
private:
/**
* Take a snapshot of the parent context, and copy
@ -178,6 +189,11 @@ private:
// being drawn to the default target, and then copy those pixels
// back to mTarget.
RefPtr<gfxContext> mTarget;
// See equivalent field in ClientLayerManager
uint32_t mPaintSequenceNumber;
// See equivalent field in ClientLayerManager
APZTestData mApzTestData;
};
} // namespace layers

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

@ -80,6 +80,7 @@ WebRenderLayerScrollData::GetTransformTyped() const
WebRenderScrollData::WebRenderScrollData()
: mIsFirstPaint(false)
, mPaintSequenceNumber(0)
{
}
@ -151,5 +152,17 @@ WebRenderScrollData::IsFirstPaint() const
return mIsFirstPaint;
}
void
WebRenderScrollData::SetPaintSequenceNumber(uint32_t aPaintSequenceNumber)
{
mPaintSequenceNumber = aPaintSequenceNumber;
}
uint32_t
WebRenderScrollData::GetPaintSequenceNumber() const
{
return mPaintSequenceNumber;
}
} // namespace layers
} // namespace mozilla

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

@ -121,6 +121,8 @@ public:
void SetIsFirstPaint();
bool IsFirstPaint() const;
void SetPaintSequenceNumber(uint32_t aPaintSequenceNumber);
uint32_t GetPaintSequenceNumber() const;
friend struct IPC::ParamTraits<WebRenderScrollData>;
@ -146,6 +148,7 @@ private:
nsTArray<WebRenderLayerScrollData> mLayerScrollData;
bool mIsFirstPaint;
uint32_t mPaintSequenceNumber;
};
} // namespace layers
@ -219,6 +222,7 @@ struct ParamTraits<mozilla::layers::WebRenderScrollData>
WriteParam(aMsg, aParam.mScrollMetadatas);
WriteParam(aMsg, aParam.mLayerScrollData);
WriteParam(aMsg, aParam.mIsFirstPaint);
WriteParam(aMsg, aParam.mPaintSequenceNumber);
}
static bool
@ -226,7 +230,8 @@ struct ParamTraits<mozilla::layers::WebRenderScrollData>
{
return ReadParam(aMsg, aIter, &aResult->mScrollMetadatas)
&& ReadParam(aMsg, aIter, &aResult->mLayerScrollData)
&& ReadParam(aMsg, aIter, &aResult->mIsFirstPaint);
&& ReadParam(aMsg, aIter, &aResult->mIsFirstPaint)
&& ReadParam(aMsg, aIter, &aResult->mPaintSequenceNumber);
}
};

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

@ -122,6 +122,7 @@
#include "RegionBuilder.h"
#include "SVGSVGElement.h"
#include "DisplayItemClip.h"
#include "mozilla/layers/WebRenderLayerManager.h"
#ifdef MOZ_XUL
#include "nsXULPopupManager.h"
@ -8508,6 +8509,8 @@ nsLayoutUtils::DoLogTestDataForPaint(LayerManager* aManager,
{
if (ClientLayerManager* mgr = aManager->AsClientLayerManager()) {
mgr->LogTestDataForCurrentPaint(aScrollId, aKey, aValue);
} else if (WebRenderLayerManager* wrlm = aManager->AsWebRenderLayerManager()) {
wrlm->LogTestDataForCurrentPaint(aScrollId, aKey, aValue);
}
}