mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990356 - Part 1: Remove lazy init of |mTimer| since we need one for most of the case. r=cpearce
This commit is contained in:
parent
12bc0f9699
commit
9595156993
@ -1047,6 +1047,12 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoderStateMachine* aCloneDonor)
|
|||||||
|
|
||||||
mStateMachineThreadPool = stateMachinePool;
|
mStateMachineThreadPool = stateMachinePool;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = mTimer->SetTarget(GetStateMachineThread());
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return mReader->Init(cloneReader);
|
return mReader->Init(cloneReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2785,11 +2791,9 @@ nsresult MediaDecoderStateMachine::ScheduleStateMachine(int64_t aUsecs) {
|
|||||||
// or have an event dispatched to run the state machine.
|
// or have an event dispatched to run the state machine.
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
if (mTimer) {
|
// We've been asked to schedule a timer to run before an existing timer.
|
||||||
// We've been asked to schedule a timer to run before an existing timer.
|
// Cancel the existing timer.
|
||||||
// Cancel the existing timer.
|
mTimer->Cancel();
|
||||||
mTimer->Cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ms = static_cast<uint32_t>((aUsecs / USECS_PER_MS) & 0xFFFFFFFF);
|
uint32_t ms = static_cast<uint32_t>((aUsecs / USECS_PER_MS) & 0xFFFFFFFF);
|
||||||
@ -2821,18 +2825,12 @@ nsresult MediaDecoderStateMachine::ScheduleStateMachine(int64_t aUsecs) {
|
|||||||
|
|
||||||
mTimeout = timeout;
|
mTimeout = timeout;
|
||||||
|
|
||||||
nsresult res;
|
nsresult rv = mTimer->InitWithFuncCallback(mozilla::TimeoutExpired,
|
||||||
if (!mTimer) {
|
this,
|
||||||
mTimer = do_CreateInstance("@mozilla.org/timer;1", &res);
|
ms,
|
||||||
if (NS_FAILED(res)) return res;
|
nsITimer::TYPE_ONE_SHOT);
|
||||||
mTimer->SetTarget(GetStateMachineThread());
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
return NS_OK;
|
||||||
|
|
||||||
res = mTimer->InitWithFuncCallback(mozilla::TimeoutExpired,
|
|
||||||
this,
|
|
||||||
ms,
|
|
||||||
nsITimer::TYPE_ONE_SHOT);
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MediaDecoderStateMachine::OnDecodeThread() const
|
bool MediaDecoderStateMachine::OnDecodeThread() const
|
||||||
|
Loading…
Reference in New Issue
Block a user