mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 986359 part 1 - Move SetTestSampleTime and LeaveTestMode to LayerTransactionParent; r=mattwoodrow
This commit is contained in:
parent
44a69247e4
commit
4d7ae1cfa3
@ -2554,9 +2554,13 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
|
||||
|
||||
nsIWidget* widget = GetWidget();
|
||||
if (widget) {
|
||||
CompositorChild* compositor = widget->GetRemoteRenderer();
|
||||
if (compositor) {
|
||||
compositor->SendSetTestSampleTime(driver->MostRecentRefresh());
|
||||
LayerManager* manager = widget->GetLayerManager();
|
||||
if (manager) {
|
||||
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
|
||||
if (forwarder && forwarder->HasShadowManager()) {
|
||||
forwarder->GetShadowManager()->SendSetTestSampleTime(
|
||||
driver->MostRecentRefresh());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2575,9 +2579,12 @@ nsDOMWindowUtils::RestoreNormalRefresh()
|
||||
// compositor.
|
||||
nsIWidget* widget = GetWidget();
|
||||
if (widget) {
|
||||
CompositorChild* compositor = widget->GetRemoteRenderer();
|
||||
if (compositor) {
|
||||
compositor->SendLeaveTestMode();
|
||||
LayerManager* manager = widget->GetLayerManager();
|
||||
if (manager) {
|
||||
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
|
||||
if (forwarder && forwarder->HasShadowManager()) {
|
||||
forwarder->GetShadowManager()->SendLeaveTestMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,34 +366,6 @@ CompositorParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
||||
{
|
||||
if (aTime.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mIsTesting = true;
|
||||
mTestTime = aTime;
|
||||
|
||||
// Update but only if we were already scheduled to animate
|
||||
if (mCompositionManager && mCurrentCompositeTask) {
|
||||
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::RecvLeaveTestMode()
|
||||
{
|
||||
mIsTesting = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::ActorDestroy(ActorDestroyReason why)
|
||||
{
|
||||
@ -805,6 +777,34 @@ CompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
|
||||
ScheduleComposition();
|
||||
}
|
||||
|
||||
bool
|
||||
CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime)
|
||||
{
|
||||
if (aTime.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mIsTesting = true;
|
||||
mTestTime = aTime;
|
||||
|
||||
// Update but only if we were already scheduled to animate
|
||||
if (mCompositionManager && mCurrentCompositeTask) {
|
||||
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
|
||||
{
|
||||
mIsTesting = false;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
|
||||
{
|
||||
@ -1067,8 +1067,6 @@ public:
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE { return true; }
|
||||
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE { return true; }
|
||||
|
||||
virtual PLayerTransactionParent*
|
||||
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
|
||||
@ -1083,6 +1081,9 @@ public:
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) MOZ_OVERRIDE;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE;
|
||||
|
||||
@ -1243,6 +1244,23 @@ CrossProcessCompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
|
||||
sIndirectLayerTrees[id].mParent->ForceComposite(aLayerTree);
|
||||
}
|
||||
|
||||
bool
|
||||
CrossProcessCompositorParent::SetTestSampleTime(
|
||||
LayerTransactionParent* aLayerTree, const TimeStamp& aTime)
|
||||
{
|
||||
uint64_t id = aLayerTree->GetId();
|
||||
MOZ_ASSERT(id != 0);
|
||||
return sIndirectLayerTrees[id].mParent->SetTestSampleTime(aLayerTree, aTime);
|
||||
}
|
||||
|
||||
void
|
||||
CrossProcessCompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
|
||||
{
|
||||
uint64_t id = aLayerTree->GetId();
|
||||
MOZ_ASSERT(id != 0);
|
||||
sIndirectLayerTrees[id].mParent->LeaveTestMode(aLayerTree);
|
||||
}
|
||||
|
||||
AsyncCompositionManager*
|
||||
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
|
||||
{
|
||||
|
@ -92,8 +92,6 @@ public:
|
||||
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
|
||||
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
|
||||
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
|
||||
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
@ -102,7 +100,11 @@ public:
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) MOZ_OVERRIDE;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE { return mCompositionManager; }
|
||||
|
||||
/**
|
||||
* This forces the is-first-paint flag to true. This is intended to
|
||||
* be called by the widget code when it loses its viewport information
|
||||
|
@ -559,6 +559,19 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
||||
{
|
||||
return mShadowLayersManager->SetTestSampleTime(this, aTime);
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvLeaveTestMode()
|
||||
{
|
||||
mShadowLayersManager->LeaveTestMode(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent,
|
||||
float* aOpacity)
|
||||
|
@ -93,6 +93,8 @@ protected:
|
||||
|
||||
virtual bool RecvClearCachedResources() MOZ_OVERRIDE;
|
||||
virtual bool RecvForceComposite() MOZ_OVERRIDE;
|
||||
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
|
||||
virtual bool RecvGetOpacity(PLayerParent* aParent,
|
||||
float* aOpacity) MOZ_OVERRIDE;
|
||||
virtual bool RecvGetAnimationTransform(PLayerParent* aParent,
|
||||
|
@ -75,12 +75,6 @@ parent:
|
||||
sync StopFrameTimeRecording(uint32_t startIndex)
|
||||
returns (float[] intervals);
|
||||
|
||||
// Enter test mode, set the sample time to sampleTime, and resample animations.
|
||||
// sampleTime must not be null.
|
||||
sync SetTestSampleTime(TimeStamp sampleTime);
|
||||
// Leave test mode and resume normal compositing
|
||||
sync LeaveTestMode();
|
||||
|
||||
// layersBackendHints is an ordered list of preffered backends where
|
||||
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
|
||||
// that hint is ignored.
|
||||
|
@ -82,6 +82,13 @@ parent:
|
||||
returns (EditReply[] reply);
|
||||
|
||||
// Testing APIs
|
||||
|
||||
// Enter test mode, set the sample time to sampleTime, and resample
|
||||
// animations. sampleTime must not be null.
|
||||
sync SetTestSampleTime(TimeStamp sampleTime);
|
||||
// Leave test mode and resume normal compositing
|
||||
sync LeaveTestMode();
|
||||
|
||||
sync GetOpacity(PLayer layer) returns (float opacity);
|
||||
|
||||
// Returns the value of the transform applied to the layer by animation after
|
||||
|
@ -25,6 +25,9 @@ public:
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; }
|
||||
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) { }
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) { return true; }
|
||||
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) { }
|
||||
};
|
||||
|
||||
} // layers
|
||||
|
Loading…
Reference in New Issue
Block a user