зеркало из https://github.com/mozilla/gecko-dev.git
Bug 980207 - When the refresh driver is under test control, make compositor thread only update when a composite is scheduled; r=dzbarsky
In order to make test behavior better match real-world sampling behavior, this patch updates the test code in CompositorParent so that it only updates the layer when a composite is scheduled. This enables creating mochitests that reproduce bugs observed in regular usage.
This commit is contained in:
Родитель
730325e4c1
Коммит
73dcc15d98
|
@ -330,8 +330,7 @@ CompositorParent::RecvFlushRendering()
|
|||
// If we're waiting to do a composite, then cancel it
|
||||
// and do it immediately instead.
|
||||
if (mCurrentCompositeTask) {
|
||||
mCurrentCompositeTask->Cancel();
|
||||
mCurrentCompositeTask = nullptr;
|
||||
CancelCurrentCompositeTask();
|
||||
ForceComposeToTarget(nullptr);
|
||||
}
|
||||
return true;
|
||||
|
@ -376,9 +375,15 @@ CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
|
|||
|
||||
mIsTesting = true;
|
||||
mTestTime = aTime;
|
||||
if (mCompositionManager) {
|
||||
mCompositionManager->TransformShadowTree(aTime);
|
||||
|
||||
// Update but only if we were already scheduled to animate
|
||||
if (mCompositionManager && mCurrentCompositeTask) {
|
||||
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -464,6 +469,15 @@ CompositorParent::ForceComposition()
|
|||
ScheduleRenderOnCompositorThread();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::CancelCurrentCompositeTask()
|
||||
{
|
||||
if (mCurrentCompositeTask) {
|
||||
mCurrentCompositeTask->Cancel();
|
||||
mCurrentCompositeTask = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::SetEGLSurfaceSize(int width, int height)
|
||||
{
|
||||
|
@ -757,12 +771,22 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
|||
|
||||
if (root) {
|
||||
SetShadowProperties(root);
|
||||
if (mIsTesting) {
|
||||
mCompositionManager->TransformShadowTree(mTestTime);
|
||||
}
|
||||
}
|
||||
if (aScheduleComposite) {
|
||||
ScheduleComposition();
|
||||
// When testing we synchronously update the shadow tree with the animated
|
||||
// values to avoid race conditions when calling GetAnimationTransform etc.
|
||||
// (since the above SetShadowProperties will remove animation effects).
|
||||
// However, we only do this update when a composite operation is already
|
||||
// scheduled in order to better match the behavior under regular sampling
|
||||
// conditions.
|
||||
if (mIsTesting && root && mCurrentCompositeTask) {
|
||||
bool requestNextFrame =
|
||||
mCompositionManager->TransformShadowTree(mTestTime);
|
||||
if (!requestNextFrame) {
|
||||
CancelCurrentCompositeTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
mLayerManager->NotifyShadowTreeTransaction();
|
||||
}
|
||||
|
|
|
@ -249,6 +249,7 @@ private:
|
|||
void ResumeComposition();
|
||||
void ResumeCompositionAndResize(int width, int height);
|
||||
void ForceComposition();
|
||||
void CancelCurrentCompositeTask();
|
||||
|
||||
inline static PlatformThreadId CompositorThreadID();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче