Bug 1268523 - Avoid leaking tasks when they are posted to a destroyed APZC instance. r=botond

MozReview-Commit-ID: 9hAkzCVg7el

--HG--
extra : rebase_source : 8f9a71ec1354fe57c1401655b81bcb178eb6d1c2
This commit is contained in:
Kartikaya Gupta 2016-04-28 11:29:35 -04:00
Родитель 502a4ed174
Коммит c1fd24b30b
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -3853,11 +3853,14 @@ AsyncPanZoomController::GetZoomConstraints() const
void AsyncPanZoomController::PostDelayedTask(already_AddRefed<Runnable> aTask, int aDelayMs) {
APZThreadUtils::AssertOnControllerThread();
RefPtr<Runnable> task = aTask;
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
controller->PostDelayedTask(Move(aTask), aDelayMs);
controller->PostDelayedTask(task.forget(), aDelayMs);
}
// XXX khuey what is supposed to happen if there's no controller? We were leaking tasks ...
// If there is no controller, that means this APZC has been destroyed, and
// we probably don't need to run the task. It will get destroyed when the
// RefPtr goes out of scope.
}
bool AsyncPanZoomController::Matches(const ScrollableLayerGuid& aGuid)