Add crash annotations before handling device resets. (bug 1363126 part 4, r=milan)
authorDavid Anderson <dvander@alliedmods.net>
Thu, 11 May 2017 22:44:28 -0700
changeset 358039 96669e08cf8f84ff6dcea0f40b243ab9f0642ccc
parent 358038 b8d1153cb94122c768648e7db8c4142f13b099b4
child 358040 d376fc7d074a893dc07c95d1331ab5243cba1b5d
push id31808
push usercbook@mozilla.com
push dateFri, 12 May 2017 12:37:49 +0000
treeherdermozilla-central@030c0a7c8781 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmilan
bugs1363126
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Add crash annotations before handling device resets. (bug 1363126 part 4, r=milan)
gfx/thebes/DeviceManagerDx.cpp
--- a/gfx/thebes/DeviceManagerDx.cpp
+++ b/gfx/thebes/DeviceManagerDx.cpp
@@ -11,17 +11,19 @@
 #include "gfxWindowsPlatform.h"
 #include "mozilla/D3DMessageUtils.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/WindowsVersion.h"
 #include "mozilla/gfx/GraphicsMessages.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/layers/CompositorThread.h"
 #include "mozilla/layers/DeviceAttachmentsD3D11.h"
+#include "nsExceptionHandler.h"
 #include "nsIGfxInfo.h"
+#include "nsPrintfCString.h"
 #include <d3d11.h>
 #include <ddraw.h>
 
 namespace mozilla {
 namespace gfx {
 
 using namespace mozilla::widget;
 
@@ -623,16 +625,23 @@ DeviceManagerDx::MaybeResetAndReacquireD
   if (!HasDeviceReset(&resetReason)) {
     return false;
   }
 
   if (resetReason != DeviceResetReason::FORCED_RESET) {
     Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
   }
 
+#ifdef MOZ_CRASHREPORTER
+  nsPrintfCString reasonString("%d", int(resetReason));
+  CrashReporter::AnnotateCrashReport(
+    NS_LITERAL_CSTRING("DeviceResetReason"),
+    reasonString);
+#endif
+
   bool createCompositorDevice = !!mCompositorDevice;
   bool createContentDevice = !!mContentDevice;
 
   ResetDevices();
 
   if (createCompositorDevice && !CreateCompositorDevices()) {
     // Just stop, don't try anything more
     return true;