Bug 1489630 - Mark AutoApplyAsyncTestAttributes as MOZ_RAII. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D5306
This commit is contained in:
Botond Ballo
2018-09-07 20:12:35 +00:00
parent 0967b35e40
commit 8b68524b51
5 changed files with 5 additions and 22 deletions

View File

@@ -92,13 +92,6 @@ public:
void MarkAsyncTransformAppliedToContent(const LayerMetricsWrapper& aLayer);
bool HasUnusedAsyncTransform(const LayerMetricsWrapper& aLayer);
/**
* Return a new AutoApplyAsyncTestAttributes instance. This should be called
* whenever we need to apply async attributes for test purposes (namely
* reftest-async-scroll-{x,y} and reftest-async-zoom).
*/
UniquePtr<AutoApplyAsyncTestAttributes> ApplyAsyncTestAttributes(const LayerMetricsWrapper& aLayer);
/**
* This can be used to assert that the current thread is the
* sampler thread (which samples the async transform).

View File

@@ -604,7 +604,7 @@ APZCTreeManager::SampleForWebRender(wr::TransactionWrapper& aTxn,
// Apply any additional async scrolling for testing purposes (used for
// reftest-async-scroll and reftest-async-zoom).
auto _ = MakeUnique<AutoApplyAsyncTestAttributes>(apzc);
AutoApplyAsyncTestAttributes testAttributeApplier(apzc);
ParentLayerPoint layerTranslation = apzc->GetCurrentAsyncTransform(
AsyncPanZoomController::eForCompositing).mTranslation;
@@ -3061,7 +3061,7 @@ APZCTreeManager::ComputeTransformForNode(const HitTestingTreeNode* aNode) const
if (AsyncPanZoomController* apzc = aNode->GetApzc()) {
// Apply any additional async scrolling for testing purposes (used for
// reftest-async-scroll and reftest-async-zoom).
auto _ = MakeUnique<AutoApplyAsyncTestAttributes>(apzc);
AutoApplyAsyncTestAttributes testAttributeApplier(apzc);
// If the node represents scrollable content, apply the async transform
// from its APZC.
return aNode->GetTransform() *
@@ -3153,7 +3153,7 @@ APZCTreeManager::ComputeTransformForScrollThumb(
// Apply any additional async scrolling for testing purposes (used for
// reftest-async-scroll and reftest-async-zoom).
auto _ = MakeUnique<AutoApplyAsyncTestAttributes>(aApzc);
AutoApplyAsyncTestAttributes testAttributeApplier(aApzc);
AsyncTransformComponentMatrix asyncTransform =
aApzc->GetCurrentAsyncTransform(AsyncPanZoomController::eForCompositing);

View File

@@ -233,16 +233,6 @@ APZSampler::HasUnusedAsyncTransform(const LayerMetricsWrapper& aLayer)
&& !AsyncTransformComponentMatrix(apzc->GetCurrentAsyncTransform(AsyncPanZoomController::eForCompositing)).IsIdentity();
}
UniquePtr<AutoApplyAsyncTestAttributes>
APZSampler::ApplyAsyncTestAttributes(const LayerMetricsWrapper& aLayer)
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
AssertOnSamplerThread();
MOZ_ASSERT(aLayer.GetApzc());
return MakeUnique<AutoApplyAsyncTestAttributes>(aLayer.GetApzc());
}
void
APZSampler::AssertOnSamplerThread() const
{

View File

@@ -104,7 +104,7 @@ struct TargetConfirmationFlags {
* An RAII class to temporarily apply async test attributes to the provided
* AsyncPanZoomController.
*/
class AutoApplyAsyncTestAttributes {
class MOZ_RAII AutoApplyAsyncTestAttributes {
public:
explicit AutoApplyAsyncTestAttributes(AsyncPanZoomController*);
~AutoApplyAsyncTestAttributes();

View File

@@ -979,7 +979,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer,
// Apply any additional async scrolling for testing purposes (used
// for reftest-async-scroll and reftest-async-zoom).
auto _ = sampler->ApplyAsyncTestAttributes(wrapper);
AutoApplyAsyncTestAttributes testAttributeApplier(wrapper.GetApzc());
const FrameMetrics& metrics = wrapper.Metrics();
MOZ_ASSERT(metrics.IsScrollable());