зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331862. Part 2 - add functions to collect debugging info asynchronously. r=kaku
MozReview-Commit-ID: 4btaZqUqyLn --HG-- extra : rebase_source : 80289bb88f7359062575e2b7f7da06e00f78cd51 extra : source : 7e011787cb911799f47b55aeba986bf05c30ed27
This commit is contained in:
Родитель
da6c0492b0
Коммит
4963f39de0
|
@ -1755,6 +1755,27 @@ MediaDecoder::DumpDebugInfo()
|
|||
}
|
||||
}
|
||||
|
||||
RefPtr<MediaDecoder::DebugInfoPromise>
|
||||
MediaDecoder::RequestDebugInfo()
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
|
||||
|
||||
auto str = GetDebugInfo();
|
||||
if (!GetStateMachine()) {
|
||||
return DebugInfoPromise::CreateAndResolve(str, __func__);
|
||||
}
|
||||
|
||||
return GetStateMachine()->RequestDebugInfo()->Then(
|
||||
AbstractThread::MainThread(), __func__,
|
||||
[str] (const nsACString& aString) {
|
||||
nsCString result = str + nsCString("\n") + aString;
|
||||
return DebugInfoPromise::CreateAndResolve(result, __func__);
|
||||
},
|
||||
[str] () {
|
||||
return DebugInfoPromise::CreateAndResolve(str, __func__);
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoder::NotifyAudibleStateChanged()
|
||||
{
|
||||
|
|
|
@ -477,6 +477,9 @@ private:
|
|||
|
||||
virtual void DumpDebugInfo();
|
||||
|
||||
using DebugInfoPromise = MozPromise<nsCString, bool, true>;
|
||||
RefPtr<DebugInfoPromise> RequestDebugInfo();
|
||||
|
||||
protected:
|
||||
virtual ~MediaDecoder();
|
||||
|
||||
|
|
|
@ -3683,6 +3683,17 @@ MediaDecoderStateMachine::DumpDebugInfo()
|
|||
AbstractThread::AssertDispatchSuccess, AbstractThread::TailDispatch);
|
||||
}
|
||||
|
||||
RefPtr<MediaDecoder::DebugInfoPromise>
|
||||
MediaDecoderStateMachine::RequestDebugInfo()
|
||||
{
|
||||
using PromiseType = MediaDecoder::DebugInfoPromise;
|
||||
RefPtr<PromiseType::Private> p = new PromiseType::Private(__func__);
|
||||
OwnerThread()->Dispatch(NS_NewRunnableFunction([this, p] () {
|
||||
p->Resolve(GetDebugInfo(), __func__);
|
||||
}), AbstractThread::AssertDispatchSuccess, AbstractThread::TailDispatch);
|
||||
return p.forget();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
|
||||
bool aFinishWhenEnded)
|
||||
{
|
||||
|
|
|
@ -162,6 +162,7 @@ public:
|
|||
};
|
||||
|
||||
void DumpDebugInfo();
|
||||
RefPtr<MediaDecoder::DebugInfoPromise> RequestDebugInfo();
|
||||
|
||||
void AddOutputStream(ProcessedMediaStream* aStream, bool aFinishWhenEnded);
|
||||
// Remove an output stream added with AddOutputStream.
|
||||
|
|
Загрузка…
Ссылка в новой задаче