Closed
Bug 2045529
Opened 23 hours ago
Closed 11 hours ago
Make the assertion+check less weird in IdleTaskRunner::ResetTimer
Categories
(Core :: XPCOM, task)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
153 Branch
| Tracking | Status | |
|---|---|---|
| firefox153 | --- | fixed |
People
(Reporter: jstutte, Assigned: jstutte)
References
Details
Attachments
(1 file)
Comment + assertion + equivalent check here:
// We rely on timers that target the main thread to be infallible (except
// for very late shutdown edge cases that should not occur, normally).
nsresult rv = mTimer->InitWithNamedFuncCallback(
TimedOut, this, aDelay.ToMilliseconds(), nsITimer::TYPE_ONE_SHOT,
mName);
if (NS_WARN_IF(NS_FAILED(rv))) {
MOZ_ASSERT(
AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads));
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
Cancel();
}
} else ...
look a bit confusing. Maybe the following would make the intention easier to follow:
nsresult rv = mTimer->InitWithNamedFuncCallback(
TimedOut, this, aDelay.ToMilliseconds(), nsITimer::TYPE_ONE_SHOT,
mName);
if (NS_WARN_IF(NS_FAILED(rv))) {
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
Cancel();
} else {
MOZ_ASSERT_UNREACHABLE("We rely on timers that target the main thread to be infallible before shutdown.");
}
} else ...
| Assignee | ||
Comment 1•23 hours ago
|
||
Replace the redundant MOZ_ASSERT + duplicate IsInOrBeyond check with a
cleaner if/else: call Cancel() in the shutdown case, and use
MOZ_ASSERT_UNREACHABLE in the impossible non-shutdown case.
Updated•23 hours ago
|
Assignee: nobody → jstutte
Status: NEW → ASSIGNED
Pushed by jstutte@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/d6bfff438523
https://hg.mozilla.org/integration/autoland/rev/290f1d01d400
Make the assertion+check less weird in IdleTaskRunner::ResetTimer. r=smaug
Comment 3•11 hours ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 11 hours ago
status-firefox153:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch
You need to log in
before you can comment on or make changes to this bug.
Description
•