mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1683031 - pt 5. Add an assertion and document idle request IDs r=smaug
Add assertions and comments to explain the behaviour/use of the idle request IDs. Depends on D99330 Differential Revision: https://phabricator.services.mozilla.com/D100300
This commit is contained in:
parent
df9efaa79e
commit
81d936b141
@ -170,12 +170,15 @@ IPCResult IdleSchedulerParent::RecvIdleTimeUsed(uint64_t aId) {
|
||||
// could arrive after the parent has granted the request.
|
||||
MOZ_ASSERT(IsWaitingForIdle() || IsDoingIdleTask());
|
||||
|
||||
if (mCurrentRequestId == aId) {
|
||||
if (IsWaitingForIdle()) {
|
||||
remove();
|
||||
}
|
||||
mRequestedIdleBudget = TimeDuration();
|
||||
// The parent process will always know the ID of the current request (since
|
||||
// the IPC channel is reliable). The IDs are provided so that the client can
|
||||
// check them (it's possible for the client to race ahead of the server).
|
||||
MOZ_ASSERT(mCurrentRequestId == aId);
|
||||
|
||||
if (IsWaitingForIdle()) {
|
||||
remove();
|
||||
}
|
||||
mRequestedIdleBudget = TimeDuration();
|
||||
Schedule(nullptr);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -196,6 +196,9 @@ void IdlePeriodState::RequestIdleToken(TimeStamp aLocalIdlePeriodHint) {
|
||||
void IdlePeriodState::SetIdleToken(uint64_t aId, TimeDuration aDuration) {
|
||||
MOZ_ASSERT(NS_IsMainThread(),
|
||||
"Why are we touching idle state off the main thread?");
|
||||
|
||||
// We check the request ID. It's possible that the server may be granting a
|
||||
// an ealier request that the client has since cancelled and re-requested.
|
||||
if (mIdleRequestId == aId) {
|
||||
mIdleToken = TimeStamp::Now() + aDuration;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user