From 03b0f72e108c640b7a7a72bdd2ff1987cfade778 Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Mon, 22 Jun 2015 17:44:00 +0200 Subject: [PATCH] Bug 1175783 - Add crash report annotations to track GMPParent shutdown. r=cpearce --- dom/media/gmp/GMPParent.cpp | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 9bd618a92a2..5ac59c1e7a1 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -31,6 +31,7 @@ using mozilla::dom::CrashReporterParent; using mozilla::ipc::GeckoChildProcessHost; #ifdef MOZ_CRASHREPORTER +#include "nsPrintfCString.h" using CrashReporter::AnnotationTable; using CrashReporter::GetIDFromMinidump; #endif @@ -196,6 +197,11 @@ AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure) { NS_WARNING("Timed out waiting for GMP async shutdown!"); GMPParent* parent = reinterpret_cast(aClosure); +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", parent->GetDisplayName().get(), parent), + NS_LITERAL_CSTRING("Timed out waiting for async shutdown")); +#endif nsRefPtr service = GeckoMediaPluginServiceParent::GetSingleton(); if (service) { @@ -239,8 +245,20 @@ GMPParent::RecvPGMPContentChildDestroyed() { --mGMPContentChildCount; if (!IsUsed()) { +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + NS_LITERAL_CSTRING("Content children destroyed")); +#endif CloseIfUnused(); } +#if defined(MOZ_CRASHREPORTER) + else { + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + nsPrintfCString("Content child destroyed, remaining: %u", mGMPContentChildCount)); + } +#endif return true; } @@ -262,9 +280,19 @@ GMPParent::CloseIfUnused() if (mAsyncShutdownRequired) { if (!mAsyncShutdownInProgress) { LOGD("%s: sending async shutdown notification", __FUNCTION__); +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + NS_LITERAL_CSTRING("Sent BeginAsyncShutdown")); +#endif mAsyncShutdownInProgress = true; if (!SendBeginAsyncShutdown() || NS_FAILED(EnsureAsyncShutdownTimeoutSet())) { +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + NS_LITERAL_CSTRING("Could not send BeginAsyncShutdown - Aborting")); +#endif AbortAsyncShutdown(); } } @@ -313,6 +341,11 @@ GMPParent::CloseActive(bool aDieWhenUnloaded) mState = GMPStateUnloading; } if (mState != GMPStateNotLoaded && IsUsed()) { +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + nsPrintfCString("Sent CloseActive, content children to close: %u", mGMPContentChildCount)); +#endif unused << SendCloseActive(); } } @@ -568,6 +601,11 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) if (AbnormalShutdown == aWhy) { nsRefPtr self(this); if (mAsyncShutdownRequired) { +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + NS_LITERAL_CSTRING("Actor destroyed")); +#endif mService->AsyncShutdownComplete(this); mAsyncShutdownRequired = false; } @@ -870,6 +908,11 @@ GMPParent::RecvAsyncShutdownComplete() LOGD("%s", __FUNCTION__); MOZ_ASSERT(mAsyncShutdownRequired); +#if defined(MOZ_CRASHREPORTER) + CrashReporter::AnnotateCrashReport( + nsPrintfCString("AsyncPluginShutdown-%s@%p", GetDisplayName().get(), this), + NS_LITERAL_CSTRING("Received AsyncShutdownComplete")); +#endif AbortAsyncShutdown(); return true; }