зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1627741: Expect an idle token only if we're actually using cross-process idle scheduling. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D69846 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
9136ce65cf
Коммит
3c7916f406
|
@ -148,9 +148,10 @@ TimeStamp IdlePeriodState::GetIdleToken(TimeStamp aLocalIdlePeriodHint,
|
|||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Why are we touching idle state off the main thread?");
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
if (!ShouldGetIdleToken()) {
|
||||
return aLocalIdlePeriodHint;
|
||||
}
|
||||
|
||||
if (mIdleToken) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
if (mIdleToken < now) {
|
||||
|
@ -170,8 +171,7 @@ void IdlePeriodState::RequestIdleToken(TimeStamp aLocalIdlePeriodHint) {
|
|||
|
||||
if (!mIdleSchedulerInitialized) {
|
||||
mIdleSchedulerInitialized = true;
|
||||
if (StaticPrefs::idle_period_cross_process_scheduling() &&
|
||||
XRE_IsContentProcess()) {
|
||||
if (ShouldGetIdleToken()) {
|
||||
// For now cross-process idle scheduler is supported only on the main
|
||||
// threads of the child processes.
|
||||
mIdleScheduler = ipc::IdleSchedulerChild::GetMainThreadIdleScheduler();
|
||||
|
@ -244,4 +244,8 @@ void IdlePeriodState::ClearIdleToken() {
|
|||
}
|
||||
}
|
||||
|
||||
bool IdlePeriodState::ShouldGetIdleToken() {
|
||||
return StaticPrefs::idle_period_cross_process_scheduling() &&
|
||||
XRE_IsContentProcess();
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -144,6 +144,10 @@ class IdlePeriodState {
|
|||
TimeStamp GetIdleDeadlineInternal(bool aIsPeek,
|
||||
const MutexAutoUnlock& aProofOfUnlock);
|
||||
|
||||
// Whether we should be getting an idle token (i.e. are a content process
|
||||
// and are using cross process idle scheduling).
|
||||
bool ShouldGetIdleToken();
|
||||
|
||||
// Set to true if we have claimed we have a ready-to-run idle task when asked.
|
||||
// In that case, we will ensure that we allow at least one task to run when
|
||||
// someone tries to run a task, even if we have run out of idle period at that
|
||||
|
|
Загрузка…
Ссылка в новой задаче