Bug 961289 - API to request compositor-side test data from client. r=BenWa,kats

--HG--
extra : source : a475bb542682486ffac8dc91a039f75ec41091b6
This commit is contained in:
Botond Ballo 2014-05-07 19:56:48 -04:00
parent 3e1e08d369
commit b02e1284b8
7 changed files with 75 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/ToString.h" // for ToString
#include "ipc/IPCMessageUtils.h"
namespace mozilla {
namespace layers {
@ -36,6 +37,7 @@ typedef uint32_t SequenceNumber;
// with the sequence number of the paint that caused the layers update.
class APZTestData {
typedef FrameMetrics::ViewID ViewID;
friend struct IPC::ParamTraits<APZTestData>;
public:
void StartNewPaint(SequenceNumber aSequenceNumber) {
auto insertResult = mPaints.insert(DataStore::value_type(aSequenceNumber, Bucket()));
@ -131,4 +133,39 @@ private:
}
}
namespace IPC {
template <>
struct ParamTraits<mozilla::layers::APZTestData>
{
typedef mozilla::layers::APZTestData paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, aParam.mPaints);
WriteParam(aMsg, aParam.mRepaintRequests);
}
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
return (ReadParam(aMsg, aIter, &aResult->mPaints) &&
ReadParam(aMsg, aIter, &aResult->mRepaintRequests));
}
};
template <>
struct ParamTraits<mozilla::layers::APZTestData::ScrollFrameData>
: ParamTraits<mozilla::layers::APZTestData::ScrollFrameDataBase> {};
template <>
struct ParamTraits<mozilla::layers::APZTestData::Bucket>
: ParamTraits<mozilla::layers::APZTestData::BucketBase> {};
template <>
struct ParamTraits<mozilla::layers::APZTestData::DataStore>
: ParamTraits<mozilla::layers::APZTestData::DataStoreBase> {};
}
#endif /* mozilla_layers_APZTestData_h */

View File

@ -858,6 +858,14 @@ CompositorParent::RecvRequestOverfill()
return true;
}
void
CompositorParent::GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData)
{
*aOutData = sIndirectLayerTrees[mRootLayerTreeID].mApzTestData;
}
void
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
{
@ -1141,6 +1149,8 @@ public:
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE;
@ -1357,6 +1367,16 @@ CrossProcessCompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
state->mParent->LeaveTestMode(aLayerTree);
}
void
CrossProcessCompositorParent::GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
*aOutData = sIndirectLayerTrees[id].mApzTestData;
}
AsyncCompositionManager*
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
{

View File

@ -104,6 +104,8 @@ public:
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE { return mCompositionManager; }
/**

View File

@ -693,6 +693,13 @@ LayerTransactionParent::RecvSetAsyncScrollOffset(PLayerParent* aLayer,
return true;
}
bool
LayerTransactionParent::RecvGetAPZTestData(APZTestData* aOutData)
{
mShadowLayersManager->GetAPZTestData(this, aOutData);
return true;
}
bool
LayerTransactionParent::Attach(ShadowLayerParent* aLayerParent,
CompositableHost* aCompositable,

View File

@ -109,6 +109,7 @@ protected:
MOZ_OVERRIDE;
virtual bool RecvSetAsyncScrollOffset(PLayerParent* aLayer,
const int32_t& aX, const int32_t& aY) MOZ_OVERRIDE;
virtual bool RecvGetAPZTestData(APZTestData* aOutData);
virtual PLayerParent* AllocPLayerParent() MOZ_OVERRIDE;
virtual bool DeallocPLayerParent(PLayerParent* actor) MOZ_OVERRIDE;

View File

@ -18,6 +18,7 @@ include "mozilla/GfxMessageUtils.h";
using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
using class mozilla::layers::APZTestData from "mozilla/layers/APZTestData.h";
/**
* The layers protocol is spoken between thread contexts that manage
@ -89,6 +90,10 @@ parent:
// Schedule a composite if one isn't already scheduled.
async ForceComposite();
// Get a copy of the compositor-side APZ test data instance for this
// layers id.
sync GetAPZTestData() returns (APZTestData data);
async ChildAsyncMessages(AsyncChildMessageData[] aMessages);
async __delete__();

View File

@ -13,6 +13,7 @@ namespace layers {
class TargetConfig;
class LayerTransactionParent;
class AsyncCompositionManager;
class APZTestData;
class ShadowLayersManager
{
@ -29,6 +30,8 @@ public:
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) { return true; }
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) { }
virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree,
APZTestData* aOutData) { }
};
} // layers