diff --git a/gfx/layers/apz/testutil/APZTestData.h b/gfx/layers/apz/testutil/APZTestData.h index c6f914bd71e1..009577a31888 100644 --- a/gfx/layers/apz/testutil/APZTestData.h +++ b/gfx/layers/apz/testutil/APZTestData.h @@ -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; public: void StartNewPaint(SequenceNumber aSequenceNumber) { auto insertResult = mPaints.insert(DataStore::value_type(aSequenceNumber, Bucket())); @@ -131,4 +133,39 @@ private: } } +namespace IPC { + +template <> +struct ParamTraits +{ + 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 + : ParamTraits {}; + +template <> +struct ParamTraits + : ParamTraits {}; + +template <> +struct ParamTraits + : ParamTraits {}; + +} + + #endif /* mozilla_layers_APZTestData_h */ diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 88cce32ff8f4..242db232baa9 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -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& 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) { diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 31288eb1c1f0..af7775929f4e 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -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; } /** diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index 60fce36fd070..ce50b3250dc0 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -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, diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index 722e16cfb40f..e52ec4de079d 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -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; diff --git a/gfx/layers/ipc/PLayerTransaction.ipdl b/gfx/layers/ipc/PLayerTransaction.ipdl index 449e59122239..cd33e03f2bd1 100644 --- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -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__(); diff --git a/gfx/layers/ipc/ShadowLayersManager.h b/gfx/layers/ipc/ShadowLayersManager.h index 7a695908ba19..02fa130966e3 100644 --- a/gfx/layers/ipc/ShadowLayersManager.h +++ b/gfx/layers/ipc/ShadowLayersManager.h @@ -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