mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
Issue #2323 - Part 3: Exclude chrome workers from worker timer clamping.
This commit is contained in:
parent
1b7df316c4
commit
2ca5715149
2 changed files with 8 additions and 2 deletions
|
|
@ -1963,6 +1963,7 @@ struct WorkerPrivate::TimeoutInfo
|
|||
, mNestingLevel(0)
|
||||
, mIsInterval(false)
|
||||
, mCanceled(false)
|
||||
, mOnChromeWorker(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerPrivate::TimeoutInfo);
|
||||
}
|
||||
|
|
@ -1992,7 +1993,8 @@ struct WorkerPrivate::TimeoutInfo
|
|||
|
||||
void CalculateTargetTime() {
|
||||
auto target = mInterval;
|
||||
if (mNestingLevel >= kClampTimeoutNestingLevel) {
|
||||
// Clamp timeout for workers, except chrome workers
|
||||
if (mNestingLevel >= kClampTimeoutNestingLevel && !mOnChromeWorker) {
|
||||
target = TimeDuration::Max(
|
||||
mInterval,
|
||||
TimeDuration::FromMilliseconds(Preferences::GetInt("dom.min_timeout_value")));
|
||||
|
|
@ -2007,6 +2009,7 @@ struct WorkerPrivate::TimeoutInfo
|
|||
uint32_t mNestingLevel;
|
||||
bool mIsInterval;
|
||||
bool mCanceled;
|
||||
bool mOnChromeWorker;
|
||||
};
|
||||
|
||||
class WorkerJSContextStats final : public JS::RuntimeStats
|
||||
|
|
@ -6100,6 +6103,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsAutoPtr<TimeoutInfo> newInfo(new TimeoutInfo());
|
||||
newInfo->mOnChromeWorker = mIsChromeWorker;
|
||||
newInfo->mIsInterval = aIsInterval;
|
||||
newInfo->mId = timerId;
|
||||
newInfo->AccumulateNestingLevel(this->mCurrentTimerNestingLevel);
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@ protected:
|
|||
RefPtr<EventTarget> mEventTarget;
|
||||
nsTArray<RefPtr<WorkerRunnable>> mPreStartRunnables;
|
||||
|
||||
// True if the worker is used in the UI
|
||||
bool mIsChromeWorker;
|
||||
|
||||
private:
|
||||
WorkerPrivate* mParent;
|
||||
nsString mScriptURL;
|
||||
|
|
@ -242,7 +245,6 @@ private:
|
|||
uint32_t mParentWindowPausedDepth;
|
||||
Status mParentStatus;
|
||||
bool mParentFrozen;
|
||||
bool mIsChromeWorker;
|
||||
bool mMainThreadObjectsForgotten;
|
||||
// mIsSecureContext is set once in our constructor; after that it can be read
|
||||
// from various threads. We could make this const if we were OK with setting
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue