Bug 1363474 - Add a method to ask whether it's safe to run code related to a given SchedulerGroup (r=froydnj)

MozReview-Commit-ID: F8uZUTfUM9v
This commit is contained in:
Bill McCloskey 2017-05-12 14:50:55 -07:00
Родитель 2f4cd5e241
Коммит 24b1d128db
1 изменённых файлов: 10 добавлений и 1 удалений

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

@ -57,10 +57,19 @@ public:
SchedulerGroup* mPrevRunningDispatcher;
};
// This function returns true if it's currently safe to run code associated
// with this SchedulerGroup. It will return true either if we're inside an
// unlabeled runnable or if we're inside a runnable labeled with this
// SchedulerGroup.
bool IsSafeToRun() const
{
return !sRunningDispatcher || mAccessValid;
}
// Ensure that it's valid to access the TabGroup at this time.
void ValidateAccess() const
{
MOZ_ASSERT(!sRunningDispatcher || mAccessValid);
MOZ_ASSERT(IsSafeToRun());
}
class Runnable final : public mozilla::Runnable