mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Bug 1000633 - Avoid APZ data race in accessing mAnimation. r=kats
This commit is contained in:
parent
fe94a83a74
commit
6c9512555d
@ -1602,6 +1602,7 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||
// smooth. If an animation frame is requested, it is the compositor's
|
||||
// responsibility to schedule a composite.
|
||||
bool requestAnimationFrame = false;
|
||||
Vector<Task*> deferredTasks;
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
@ -1616,12 +1617,19 @@ bool AsyncPanZoomController::SampleContentTransformForFrame(const TimeStamp& aSa
|
||||
ParentLayerSize(mFrameMetrics.mCompositionBounds.Size()) / mFrameMetrics.GetZoomToParent()));
|
||||
|
||||
mCurrentAsyncScrollOffset = mFrameMetrics.GetScrollOffset();
|
||||
|
||||
// Get any deferred tasks queued up by mAnimation's Sample() (called by
|
||||
// UpdateAnimation()). This needs to be done here since mAnimation can
|
||||
// be destroyed by another thread when we release the monitor, but
|
||||
// the tasks need to be executed after we release the monitor since they
|
||||
// are allowed to call APZCTreeManager methods which can grab the tree lock.
|
||||
if (mAnimation) {
|
||||
deferredTasks = mAnimation->TakeDeferredTasks();
|
||||
}
|
||||
}
|
||||
|
||||
// Execute tasks queued up by mAnimation's Sample() (called by
|
||||
// UpdateAnimation()) for execution after mMonitor has been released.
|
||||
if (mAnimation) {
|
||||
mAnimation->ExecuteDeferredTasks();
|
||||
for (uint32_t i = 0; i < deferredTasks.length(); ++i) {
|
||||
deferredTasks[i]->Run();
|
||||
}
|
||||
|
||||
// Cancel the mAsyncScrollTimeoutTask because we will fire a
|
||||
|
@ -948,14 +948,14 @@ public:
|
||||
const TimeDuration& aDelta) = 0;
|
||||
|
||||
/**
|
||||
* Execute the tasks in |mDeferredTasks| in order. See |mDeferredTasks|
|
||||
* Get the deferred tasks in |mDeferredTasks|. See |mDeferredTasks|
|
||||
* for more information.
|
||||
* Clears |mDeferredTasks|.
|
||||
*/
|
||||
void ExecuteDeferredTasks() {
|
||||
for (uint32_t i = 0; i < mDeferredTasks.length(); ++i) {
|
||||
mDeferredTasks[i]->Run();
|
||||
}
|
||||
mDeferredTasks.clear();
|
||||
Vector<Task*> TakeDeferredTasks() {
|
||||
Vector<Task*> result;
|
||||
mDeferredTasks.swap(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user