Bug 1393399 P2 - keep the GPU process crash time and send back to MFR; r=gerald

We keep the GPU crash time and send back to MFR through MediaResult.

We cannot save the information in VideoDecoderChild as a static member because we are going to read it in MFR's task queue and the data was written in VideoDecoderManager's thread. This is going to be racing.

MozReview-Commit-ID: FXqOgelWY6e

--HG--
extra : rebase_source : 5c0561e009ad16983e1ff910216f9cf7901b5542
This commit is contained in:
Kaku Kuo 2017-08-31 17:21:28 +08:00
parent 5a09d32a1e
commit 15e39cee1b
3 changed files with 24 additions and 14 deletions

View File

@ -9,6 +9,7 @@
#include "nsString.h" // Required before 'mozilla/ErrorNames.h'!?
#include "mozilla/ErrorNames.h"
#include "mozilla/TimeStamp.h"
#include "nsError.h"
#include "nsPrintfCString.h"
@ -62,9 +63,13 @@ public:
mMessage.get());
}
void SetGPUCrashTimeStamp(const TimeStamp& aTime) { mGPUCrashTimeStamp = aTime; }
const TimeStamp& GPUCrashTimeStamp() const { return mGPUCrashTimeStamp; }
private:
nsresult mCode;
nsCString mMessage;
TimeStamp mGPUCrashTimeStamp; // Used in bug 1393399 for temporary telemetry usage.
};
#ifdef _MSC_VER

View File

@ -140,25 +140,26 @@ void
VideoDecoderChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
// GPU process crashed, record the time and send back to MFR for telemetry.
mGPUCrashTime = TimeStamp::Now();
// Defer reporting an error until we've recreated the manager so that
// it'll be safe for MediaFormatReader to recreate decoders
RefPtr<VideoDecoderChild> ref = this;
GetManager()->RunWhenRecreated(
NS_NewRunnableFunction("dom::VideoDecoderChild::ActorDestroy", [=]() {
MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
error.SetGPUCrashTimeStamp(ref->mGPUCrashTime);
if (ref->mInitialized) {
mDecodedData.Clear();
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER,
__func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER,
__func__);
mFlushPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER,
__func__);
mDecodePromise.RejectIfExists(error, __func__);
mDrainPromise.RejectIfExists(error, __func__);
mFlushPromise.RejectIfExists(error, __func__);
// Make sure the next request will be rejected accordingly if ever
// called.
mNeedNewDecoder = true;
} else {
ref->mInitPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER,
__func__);
ref->mInitPromise.RejectIfExists(error, __func__);
}
}));
}
@ -245,8 +246,9 @@ VideoDecoderChild::Decode(MediaRawData* aSample)
AssertOnManagerThread();
if (mNeedNewDecoder) {
return MediaDataDecoder::DecodePromise::CreateAndReject(
NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__);
MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
error.SetGPUCrashTimeStamp(mGPUCrashTime);
return MediaDataDecoder::DecodePromise::CreateAndReject(error, __func__);
}
if (!mCanSend) {
// We're here if the IPC channel has died but we're still waiting for the
@ -284,8 +286,9 @@ VideoDecoderChild::Flush()
mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
mDrainPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
if (mNeedNewDecoder) {
return MediaDataDecoder::FlushPromise::CreateAndReject(
NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__);
MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
error.SetGPUCrashTimeStamp(mGPUCrashTime);
return MediaDataDecoder::FlushPromise::CreateAndReject(error, __func__);
}
if (mCanSend) {
SendFlush();
@ -298,8 +301,9 @@ VideoDecoderChild::Drain()
{
AssertOnManagerThread();
if (mNeedNewDecoder) {
return MediaDataDecoder::DecodePromise::CreateAndReject(
NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER, __func__);
MediaResult error(NS_ERROR_DOM_MEDIA_NEED_NEW_DECODER);
error.SetGPUCrashTimeStamp(mGPUCrashTime);
return MediaDataDecoder::DecodePromise::CreateAndReject(error, __func__);
}
if (mCanSend) {
SendDrain();

View File

@ -82,6 +82,7 @@ private:
nsCString mBlacklistedD3D11Driver;
nsCString mBlacklistedD3D9Driver;
TimeStamp mGPUCrashTime;
};
} // namespace dom