/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
bool IdleSchedulerChild::SetPaused() { if (mChildId && CanSend() && mActiveCounter->Memory()) {
--(static_cast<Atomic<int32_t>*>(mActiveCounter->Memory())[mChildId]); // The following expression reduces the global activity count and checks if // it drops below the cpu counter limit. return (static_cast<Atomic<int32_t>*>(mActiveCounter->Memory())
[NS_IDLE_SCHEDULER_INDEX_OF_ACTIVITY_COUNTER])-- == static_cast<Atomic<int32_t>*>(
mActiveCounter
->Memory())[NS_IDLE_SCHEDULER_INDEX_OF_CPU_COUNTER];
}
mIsRequestingGC = true; return SendRequestGC()->Then(
GetMainThreadSerialEventTarget(), __func__,
[self = RefPtr(this)](bool aIgnored) { // Only one of these may be true at a time.
MOZ_ASSERT(!(self->mIsRequestingGC && self->mIsDoingGC));
// The parent process always says yes, sometimes after a delay. if (self->mIsRequestingGC) {
self->mIsRequestingGC = false;
self->mIsDoingGC = true; return MayGCPromise::CreateAndResolve(true, __func__);
} return MayGCPromise::CreateAndResolve(false, __func__);
},
[self = RefPtr(this)](ResponseRejectReason reason) {
self->mIsRequestingGC = false; return MayGCPromise::CreateAndReject(reason, __func__);
});
}
void IdleSchedulerChild::StartedGC() { // Only one of these may be true at a time.
MOZ_ASSERT(!(mIsRequestingGC && mIsDoingGC));
// If mRequestingGC was true then when the outstanding GC request returns // it'll see that the GC has already started.
mIsRequestingGC = false;
if (!mIsDoingGC) { if (CanSend()) {
SendStartedGC();
}
mIsDoingGC = true;
}
}
void IdleSchedulerChild::DoneGC() { if (mIsDoingGC) { if (CanSend()) {
SendDoneGC();
}
mIsDoingGC = false;
}
}
if (sMainThreadIdleScheduler) { return sMainThreadIdleScheduler;
}
if (sIdleSchedulerDestroyed) { return nullptr;
}
ipc::PBackgroundChild* background =
ipc::BackgroundChild::GetOrCreateForCurrentThread(); if (background) { // this is nulled out on our destruction, so we don't need to worry
sMainThreadIdleScheduler = new ipc::IdleSchedulerChild();
MOZ_ALWAYS_TRUE(
background->SendPIdleSchedulerConstructor(sMainThreadIdleScheduler));
} return sMainThreadIdleScheduler;
}
} // namespace mozilla::ipc
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.