mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
import from UXP: Issue #2323 - Part 3: Exclude chrome workers from worker timer clamping. (2ca57151)
This commit is contained in:
@@ -1921,6 +1921,7 @@ struct WorkerPrivate::TimeoutInfo
|
||||
, mNestingLevel(0)
|
||||
, mIsInterval(false)
|
||||
, mCanceled(false)
|
||||
, mOnChromeWorker(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(mozilla::dom::workers::WorkerPrivate::TimeoutInfo);
|
||||
}
|
||||
@@ -1950,7 +1951,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")));
|
||||
@@ -1965,6 +1967,7 @@ struct WorkerPrivate::TimeoutInfo
|
||||
uint32_t mNestingLevel;
|
||||
bool mIsInterval;
|
||||
bool mCanceled;
|
||||
bool mOnChromeWorker;
|
||||
};
|
||||
|
||||
class WorkerJSContextStats final : public JS::RuntimeStats
|
||||
@@ -6040,6 +6043,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx,
|
||||
}
|
||||
|
||||
nsAutoPtr<TimeoutInfo> newInfo(new TimeoutInfo());
|
||||
newInfo->mOnChromeWorker = mIsChromeWorker;
|
||||
newInfo->mIsInterval = aIsInterval;
|
||||
newInfo->mId = timerId;
|
||||
newInfo->AccumulateNestingLevel(this->mCurrentTimerNestingLevel);
|
||||
|
||||
@@ -214,6 +214,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;
|
||||
@@ -243,7 +246,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
|
||||
|
||||
Reference in New Issue
Block a user