Add crash reporter annotations for the GPU process status. (bug 1343650, r=billm)
authorDavid Anderson <danderson@mozilla.com>
Mon, 03 Apr 2017 15:11:27 -0700
changeset 555398 328c81f2402ca1e235108167a936fd5c4c2881ed
parent 555397 a31c259f06ac5ca1f5211cc1b66724b07b0176a7
child 555399 599e7c3933217e0dfd66403f40c4b8a4c8b31224
push id52236
push usercykesiopka.bmo@gmail.com
push dateTue, 04 Apr 2017 09:12:57 +0000
reviewersbillm
bugs1343650
milestone55.0a1
Add crash reporter annotations for the GPU process status. (bug 1343650, r=billm)
gfx/ipc/GPUProcessManager.cpp
--- a/gfx/ipc/GPUProcessManager.cpp
+++ b/gfx/ipc/GPUProcessManager.cpp
@@ -32,16 +32,20 @@
 #include "VRManagerParent.h"
 #include "VsyncBridgeChild.h"
 #include "VsyncIOThreadHolder.h"
 #include "VsyncSource.h"
 #include "mozilla/dom/VideoDecoderManagerChild.h"
 #include "mozilla/dom/VideoDecoderManagerParent.h"
 #include "MediaPrefs.h"
 
+#ifdef MOZ_CRASHREPORTER
+# include "nsExceptionHandler.h"
+#endif
+
 #if defined(MOZ_WIDGET_ANDROID)
 #include "mozilla/widget/AndroidUiThread.h"
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #endif // defined(MOZ_WIDGET_ANDROID)
 
 namespace mozilla {
 namespace gfx {
 
@@ -302,16 +306,22 @@ GPUProcessManager::OnProcessLaunchComple
   mVsyncBridge = VsyncBridgeChild::Create(mVsyncIOThread, mProcessToken, Move(vsyncChild));
   mGPUChild->SendInitVsyncBridge(Move(vsyncParent));
 
   nsTArray<LayerTreeIdMapping> mappings;
   LayerTreeOwnerTracker::Get()->Iterate([&](uint64_t aLayersId, base::ProcessId aProcessId) {
     mappings.AppendElement(LayerTreeIdMapping(aLayersId, aProcessId));
   });
   mGPUChild->SendAddLayerTreeIdMapping(mappings);
+
+#ifdef MOZ_CRASHREPORTER
+  CrashReporter::AnnotateCrashReport(
+    NS_LITERAL_CSTRING("GPUProcessStatus"),
+    NS_LITERAL_CSTRING("Running"));
+#endif
 }
 
 static bool
 ShouldLimitDeviceResets(uint32_t count, int32_t deltaMilliseconds)
 {
   // We decide to limit by comparing the amount of resets that have happened
   // and time since the last reset to two prefs. 
   int32_t timeLimit = gfxPrefs::DeviceResetThresholdMilliseconds();
@@ -525,16 +535,22 @@ GPUProcessManager::DestroyProcess()
   mGPUChild = nullptr;
   if (mVsyncBridge) {
     mVsyncBridge->Close();
     mVsyncBridge = nullptr;
   }
 #if defined(MOZ_WIDGET_ANDROID)
   UiCompositorControllerChild::Shutdown();
 #endif // defined(MOZ_WIDGET_ANDROID)
+
+#ifdef MOZ_CRASHREPORTER
+  CrashReporter::AnnotateCrashReport(
+    NS_LITERAL_CSTRING("GPUProcessStatus"),
+    NS_LITERAL_CSTRING("Destroyed"));
+#endif
 }
 
 RefPtr<CompositorSession>
 GPUProcessManager::CreateTopLevelCompositor(nsBaseWidget* aWidget,
                                             LayerManager* aLayerManager,
                                             CSSToLayoutDeviceScale aScale,
                                             const CompositorOptions& aOptions,
                                             bool aUseExternalSurfaceSize,