mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1499727 - make nsHtml5StreamParser timers slightly more efficient; r=hsivonen
Instead of creating a timer and then setting the timer's target, we can determine the timer's target and pass it in directly when the timer is created. This reordering of steps is slightly more efficient, since SetTarget() is both a virtual call and requires locking, both of which can be skipped if we know the target at timer creation time.
This commit is contained in:
parent
d75b9ed4bd
commit
7d5d1b760a
@ -177,14 +177,13 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor,
|
||||
, mFeedChardet(false)
|
||||
, mInitialEncodingWasFromParentFrame(false)
|
||||
, mHasHadErrors(false)
|
||||
, mFlushTimer(NS_NewTimer())
|
||||
, mFlushTimer(NS_NewTimer(mEventTarget))
|
||||
, mFlushTimerMutex("nsHtml5StreamParser mFlushTimerMutex")
|
||||
, mFlushTimerArmed(false)
|
||||
, mFlushTimerEverFired(false)
|
||||
, mMode(aMode)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mFlushTimer->SetTarget(mEventTarget);
|
||||
#ifdef DEBUG
|
||||
mAtomTable.SetPermittedLookupEventTarget(mEventTarget);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user