зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1443792 - Move the SampleAPZAnimations function into APZSampler. r=botond
MozReview-Commit-ID: 2KIQ5A2J7m9 --HG-- extra : rebase_source : c3fa7b3ff696413552d8659796438fc67c6e7202
This commit is contained in:
Родитель
63c51237ff
Коммит
9edc276575
|
@ -25,6 +25,7 @@ namespace layers {
|
|||
class APZCTreeManager;
|
||||
class FocusTarget;
|
||||
class Layer;
|
||||
class LayerMetricsWrapper;
|
||||
class WebRenderScrollData;
|
||||
|
||||
/**
|
||||
|
@ -70,6 +71,9 @@ public:
|
|||
const FrameMetrics::ViewID& aScrollId,
|
||||
const LayerToParentLayerScale& aZoom);
|
||||
|
||||
bool SampleAnimations(const LayerMetricsWrapper& aLayer,
|
||||
const TimeStamp& aSampleTime);
|
||||
|
||||
protected:
|
||||
virtual ~APZSampler();
|
||||
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
#include "mozilla/layers/APZSampler.h"
|
||||
|
||||
#include "APZCTreeManager.h"
|
||||
#include "AsyncPanZoomController.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h"
|
||||
#include "TreeTraversal.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -122,5 +125,29 @@ APZSampler::SetTestAsyncZoom(uint64_t aLayersId,
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
APZSampler::SampleAnimations(const LayerMetricsWrapper& aLayer,
|
||||
const TimeStamp& aSampleTime)
|
||||
{
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
|
||||
// TODO: eventually we can drop the aLayer argument and just walk the APZ
|
||||
// tree directly in mApz.
|
||||
|
||||
bool activeAnimations = false;
|
||||
|
||||
ForEachNodePostOrder<ForwardIterator>(aLayer,
|
||||
[&activeAnimations, &aSampleTime](LayerMetricsWrapper aLayerMetrics)
|
||||
{
|
||||
if (AsyncPanZoomController* apzc = aLayerMetrics.GetApzc()) {
|
||||
apzc->ReportCheckerboard(aSampleTime);
|
||||
activeAnimations |= apzc->AdvanceAnimations(aSampleTime);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return activeAnimations;
|
||||
}
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/gfx/Rect.h" // for RoundedToInt, RectTyped
|
||||
#include "mozilla/gfx/ScaleFactor.h" // for ScaleFactor
|
||||
#include "mozilla/layers/AnimationHelper.h"
|
||||
#include "mozilla/layers/APZSampler.h" // for APZSampler
|
||||
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/CompositorBridgeParent.h" // for CompositorBridgeParent, etc
|
||||
|
@ -68,14 +69,15 @@ ContentMightReflowOnOrientationChange(const IntRect& rect)
|
|||
return rect.Width() != rect.Height();
|
||||
}
|
||||
|
||||
AsyncCompositionManager::AsyncCompositionManager(CompositorBridgeParent* aParent,
|
||||
HostLayerManager* aManager)
|
||||
AsyncCompositionManager::AsyncCompositionManager(CompositorBridgeParent* aParent,
|
||||
HostLayerManager* aManager)
|
||||
: mLayerManager(aManager)
|
||||
, mIsFirstPaint(true)
|
||||
, mLayersUpdated(false)
|
||||
, mReadyForCompose(true)
|
||||
, mCompositorBridge(aParent)
|
||||
{
|
||||
MOZ_ASSERT(mCompositorBridge);
|
||||
}
|
||||
|
||||
AsyncCompositionManager::~AsyncCompositionManager()
|
||||
|
@ -695,24 +697,6 @@ SampleAnimations(Layer* aLayer,
|
|||
return animProcess;
|
||||
}
|
||||
|
||||
static bool
|
||||
SampleAPZAnimations(const LayerMetricsWrapper& aLayer, TimeStamp aSampleTime)
|
||||
{
|
||||
bool activeAnimations = false;
|
||||
|
||||
ForEachNodePostOrder<ForwardIterator>(aLayer,
|
||||
[&activeAnimations, &aSampleTime](LayerMetricsWrapper aLayerMetrics)
|
||||
{
|
||||
if (AsyncPanZoomController* apzc = aLayerMetrics.GetApzc()) {
|
||||
apzc->ReportCheckerboard(aSampleTime);
|
||||
activeAnimations |= apzc->AdvanceAnimations(aSampleTime);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return activeAnimations;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer)
|
||||
{
|
||||
|
@ -1439,7 +1423,10 @@ AsyncCompositionManager::TransformShadowTree(TimeStamp aCurrentFrame,
|
|||
#endif
|
||||
}
|
||||
|
||||
bool apzAnimating = SampleAPZAnimations(LayerMetricsWrapper(root), nextFrame);
|
||||
bool apzAnimating = false;
|
||||
if (RefPtr<APZSampler> apz = mCompositorBridge->GetAPZSampler()) {
|
||||
apzAnimating = apz->SampleAnimations(LayerMetricsWrapper(root), nextFrame);
|
||||
}
|
||||
mAnimationMetricsTracker.UpdateApzAnimationInProgress(apzAnimating, aVsyncRate);
|
||||
wantNextFrame |= apzAnimating;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ private:
|
|||
TimeStamp mPreviousFrameTimeStamp;
|
||||
AnimationMetricsTracker mAnimationMetricsTracker;
|
||||
|
||||
CompositorBridgeParent* mCompositorBridge;
|
||||
MOZ_NON_OWNING_REF CompositorBridgeParent* mCompositorBridge;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче