зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1586370 - Rename GraphDriver::OnGraphThread to InIteration. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D56081 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7e49593412
Коммит
7502376eec
|
@ -40,7 +40,7 @@ GraphDriver::GraphDriver(MediaTrackGraphImpl* aGraphImpl,
|
|||
|
||||
void GraphDriver::SetState(GraphTime aIterationStart, GraphTime aIterationEnd,
|
||||
GraphTime aStateComputedTime) {
|
||||
MOZ_ASSERT(OnGraphThread() || !ThreadRunning());
|
||||
MOZ_ASSERT(InIteration() || !ThreadRunning());
|
||||
|
||||
mIterationStart = aIterationStart;
|
||||
mIterationEnd = aIterationEnd;
|
||||
|
@ -48,18 +48,16 @@ void GraphDriver::SetState(GraphTime aIterationStart, GraphTime aIterationEnd,
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool GraphDriver::OnGraphThread() {
|
||||
return GraphImpl()->RunByGraphDriver(this);
|
||||
}
|
||||
bool GraphDriver::InIteration() { return GraphImpl()->InDriverIteration(this); }
|
||||
#endif
|
||||
|
||||
GraphDriver* GraphDriver::PreviousDriver() {
|
||||
MOZ_ASSERT(OnGraphThread() || !ThreadRunning());
|
||||
MOZ_ASSERT(InIteration() || !ThreadRunning());
|
||||
return mPreviousDriver;
|
||||
}
|
||||
|
||||
void GraphDriver::SetPreviousDriver(GraphDriver* aPreviousDriver) {
|
||||
MOZ_ASSERT(OnGraphThread() || !ThreadRunning());
|
||||
MOZ_ASSERT(InIteration() || !ThreadRunning());
|
||||
mPreviousDriver = aPreviousDriver;
|
||||
}
|
||||
|
||||
|
@ -565,7 +563,7 @@ bool AudioCallbackDriver::Init() {
|
|||
void AudioCallbackDriver::Start() {
|
||||
MOZ_ASSERT(!IsStarted());
|
||||
MOZ_ASSERT(NS_IsMainThread() || OnCubebOperationThread() ||
|
||||
(PreviousDriver() && PreviousDriver()->OnGraphThread()));
|
||||
(PreviousDriver() && PreviousDriver()->InIteration()));
|
||||
if (mPreviousDriver) {
|
||||
if (mPreviousDriver->AsAudioCallbackDriver()) {
|
||||
LOG(LogLevel::Debug, ("Releasing audio driver off main thread."));
|
||||
|
@ -813,7 +811,7 @@ static const char* StateToString(cubeb_state aState) {
|
|||
}
|
||||
|
||||
void AudioCallbackDriver::StateCallback(cubeb_state aState) {
|
||||
MOZ_ASSERT(!OnGraphThread());
|
||||
MOZ_ASSERT(!InIteration());
|
||||
LOG(LogLevel::Debug,
|
||||
("AudioCallbackDriver State: %s", StateToString(aState)));
|
||||
|
||||
|
@ -834,7 +832,7 @@ void AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer,
|
|||
AudioSampleFormat aFormat,
|
||||
uint32_t aChannels, uint32_t aFrames,
|
||||
uint32_t aSampleRate) {
|
||||
MOZ_ASSERT(OnGraphThread());
|
||||
MOZ_ASSERT(InIteration());
|
||||
uint32_t toWrite = mBuffer.Available();
|
||||
|
||||
if (!mBuffer.Available()) {
|
||||
|
@ -884,7 +882,7 @@ void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive) {
|
|||
}
|
||||
|
||||
void AudioCallbackDriver::DeviceChangedCallback() {
|
||||
MOZ_ASSERT(!OnGraphThread());
|
||||
MOZ_ASSERT(!InIteration());
|
||||
// Tell the audio engine the device has changed, it might want to reset some
|
||||
// state.
|
||||
MonitorAutoLock mon(mGraphImpl->GetMonitor());
|
||||
|
@ -900,7 +898,7 @@ void AudioCallbackDriver::DeviceChangedCallback() {
|
|||
}
|
||||
|
||||
uint32_t AudioCallbackDriver::IterationDuration() {
|
||||
MOZ_ASSERT(OnGraphThread());
|
||||
MOZ_ASSERT(InIteration());
|
||||
// The real fix would be to have an API in cubeb to give us the number. Short
|
||||
// of that, we approximate it here. bug 1019507
|
||||
return mIterationDurationMS;
|
||||
|
@ -912,7 +910,7 @@ void AudioCallbackDriver::EnqueueTrackAndPromiseForOperation(
|
|||
MediaTrack* aTrack, dom::AudioContextOperation aOperation,
|
||||
AbstractThread* aMainThread,
|
||||
MozPromiseHolder<MediaTrackGraph::AudioContextOperationPromise>&& aHolder) {
|
||||
MOZ_ASSERT(OnGraphThread() || !ThreadRunning());
|
||||
MOZ_ASSERT(InIteration() || !ThreadRunning());
|
||||
auto promises = mPromisesForOperation.Lock();
|
||||
promises->AppendElement(TrackAndPromiseForOperation(
|
||||
aTrack, aOperation, aMainThread, std::move(aHolder)));
|
||||
|
|
|
@ -262,8 +262,8 @@ class GraphDriver {
|
|||
MediaTrackGraphImpl* GraphImpl() const { return mGraphImpl; }
|
||||
|
||||
#ifdef DEBUG
|
||||
// True if the current thread is driving the MTG.
|
||||
bool OnGraphThread();
|
||||
// True if the current thread is currently iterating the MTG.
|
||||
bool InIteration();
|
||||
#endif
|
||||
// True if the current thread is the GraphDriver's thread.
|
||||
virtual bool OnThread() = 0;
|
||||
|
|
|
@ -129,7 +129,7 @@ bool GraphRunner::OnThread() {
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool GraphRunner::RunByGraphDriver(GraphDriver* aDriver) {
|
||||
bool GraphRunner::InDriverIteration(GraphDriver* aDriver) {
|
||||
if (!OnThread()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class GraphRunner final : public Runnable {
|
|||
* Returns true if called on mThread, and aDriver was the driver that called
|
||||
* OneIteration() last.
|
||||
*/
|
||||
bool RunByGraphDriver(GraphDriver* aDriver);
|
||||
bool InDriverIteration(GraphDriver* aDriver);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
|
@ -2945,9 +2945,9 @@ AbstractThread* MediaTrackGraph::AbstractMainThread() {
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool MediaTrackGraphImpl::RunByGraphDriver(GraphDriver* aDriver) {
|
||||
bool MediaTrackGraphImpl::InDriverIteration(GraphDriver* aDriver) {
|
||||
return aDriver->OnThread() ||
|
||||
(mGraphRunner && mGraphRunner->RunByGraphDriver(aDriver));
|
||||
(mGraphRunner && mGraphRunner->InDriverIteration(aDriver));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* True if we're on aDriver's thread, or if we're on mGraphRunner's thread
|
||||
* and mGraphRunner is currently run by aDriver.
|
||||
*/
|
||||
bool RunByGraphDriver(GraphDriver* aDriver);
|
||||
bool InDriverIteration(GraphDriver* aDriver);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -576,7 +576,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
|
|||
* Monitor must be held.
|
||||
*/
|
||||
void SetCurrentDriver(GraphDriver* aDriver) {
|
||||
MOZ_ASSERT_IF(mDriver->ThreadRunning(), RunByGraphDriver(mDriver));
|
||||
MOZ_ASSERT_IF(mDriver->ThreadRunning(), InDriverIteration(mDriver));
|
||||
MOZ_ASSERT_IF(!mDriver->ThreadRunning(), NS_IsMainThread());
|
||||
mDriver = aDriver;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче