mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 18:24:02 +00:00
Bug 1009118 - Add isUnlimited to SliceBudget. r=jonco
This commit is contained in:
parent
b62698ca6d
commit
08ed56db1d
@ -35,8 +35,8 @@ struct JS_PUBLIC_API(SliceBudget)
|
||||
SliceBudget(int64_t budget);
|
||||
|
||||
void reset() {
|
||||
deadline = INT64_MAX;
|
||||
counter = INTPTR_MAX;
|
||||
deadline = unlimitedDeadline;
|
||||
counter = unlimitedStartCounter;
|
||||
}
|
||||
|
||||
void step(intptr_t amt = 1) {
|
||||
@ -50,6 +50,15 @@ struct JS_PUBLIC_API(SliceBudget)
|
||||
return false;
|
||||
return checkOverBudget();
|
||||
}
|
||||
|
||||
bool isUnlimited() {
|
||||
return deadline == unlimitedDeadline;
|
||||
}
|
||||
|
||||
private:
|
||||
static const int64_t unlimitedDeadline = INT64_MAX;
|
||||
static const intptr_t unlimitedStartCounter = INTPTR_MAX;
|
||||
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
|
@ -1935,16 +1935,14 @@ SliceBudget::WorkBudget(int64_t work)
|
||||
}
|
||||
|
||||
SliceBudget::SliceBudget()
|
||||
: deadline(INT64_MAX),
|
||||
counter(INTPTR_MAX)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
SliceBudget::SliceBudget(int64_t budget)
|
||||
{
|
||||
if (budget == Unlimited) {
|
||||
deadline = INT64_MAX;
|
||||
counter = INTPTR_MAX;
|
||||
reset();
|
||||
} else if (budget > 0) {
|
||||
deadline = PRMJ_Now() + budget;
|
||||
counter = CounterReset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user