Bug 1640835 - Bail out early from InputQueue::MainThreadTimeout if sControllerThread has been already discarded. r=botond

Differential Revision: https://phabricator.services.mozilla.com/D85335
This commit is contained in:
Hiroyuki Ikezoe 2020-07-29 23:25:11 +00:00
Родитель 272f16a911
Коммит 63133b1845
3 изменённых файлов: 16 добавлений и 0 удалений

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

@ -677,6 +677,11 @@ InputBlockState* InputQueue::FindBlockForId(uint64_t aInputBlockId,
}
void InputQueue::MainThreadTimeout(uint64_t aInputBlockId) {
// It's possible that this function gets called after the controller thread
// was discarded during shutdown.
if (!APZThreadUtils::IsControllerThreadAlive()) {
return;
}
APZThreadUtils::AssertOnControllerThread();
INPQ_LOG("got a main thread timeout; block=%" PRIu64 "\n", aInputBlockId);

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

@ -84,6 +84,12 @@ bool APZThreadUtils::IsControllerThread() {
return sControllerThread && sControllerThread->IsOnCurrentThread();
}
/*static*/
bool APZThreadUtils::IsControllerThreadAlive() {
StaticMutexAutoLock lock(sControllerThreadMutex);
return !!sControllerThread;
}
/*static*/
void APZThreadUtils::DelayedDispatch(already_AddRefed<Runnable> aRunnable,
int aDelayMs) {

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

@ -53,6 +53,11 @@ class APZThreadUtils {
*/
static bool IsControllerThread();
/**
* Returns true if the controller thread is still alive.
*/
static bool IsControllerThreadAlive();
/**
* Schedules a runnable to run on the controller thread at some time
* in the future.