Bug 1348273 - Convert the media-related annotations; r?cpearce draft
authorGabriele Svelto <gsvelto@mozilla.com>
Sat, 17 Mar 2018 21:58:56 +0100
changeset 781404 84d17dbe80165ba89c686be4d02a2d6a1ab82ca2
parent 781403 ccdfe19b67fa65add5cb6d203837a3d46b2ff155
child 781405 ec23ba7d43633ea9fca4af4c73e596c044ebdf1a
push id106292
push usergsvelto@mozilla.com
push dateThu, 12 Apr 2018 22:06:23 +0000
reviewerscpearce
bugs1348273
milestone61.0a1
Bug 1348273 - Convert the media-related annotations; r?cpearce MozReview-Commit-ID: 4QRgwAHN0w5
dom/media/gmp/GMPChild.cpp
dom/media/gmp/GMPParent.cpp
toolkit/crashreporter/CrashAnnotations.yaml
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -549,18 +549,19 @@ ToCString(const nsTArray<Pair<nsCString,
 
 mozilla::ipc::IPCResult
 GMPChild::AnswerStartPlugin(const nsString& aAdapter)
 {
   LOGD("%s", __FUNCTION__);
 
   nsCString libPath;
   if (!GetUTF8LibPath(libPath)) {
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GMPLibraryPath"),
-                                       NS_ConvertUTF16toUTF8(mPluginPath));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::GMPLibraryPath,
+      NS_ConvertUTF16toUTF8(mPluginPath));
 
 #ifdef XP_WIN
     return IPC_FAIL(
       this,
       nsPrintfCString("Failed to get lib path with error(%d).", GetLastError())
         .get());
 #else
     return IPC_FAIL(
@@ -604,18 +605,19 @@ GMPChild::AnswerStartPlugin(const nsStri
   }
 
   if (!mGMPLoader->Load(libPath.get(),
                         libPath.Length(),
                         platformAPI,
                         adapter)) {
     NS_WARNING("Failed to load GMP");
     delete platformAPI;
-    CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GMPLibraryPath"),
-                                       NS_ConvertUTF16toUTF8(mPluginPath));
+    CrashReporter::AnnotateCrashReport(
+      CrashReporter::Annotation::GMPLibraryPath,
+      NS_ConvertUTF16toUTF8(mPluginPath));
 
 #ifdef XP_WIN
     return IPC_FAIL(
       this,
       nsPrintfCString("Failed to load GMP with error(%d).", GetLastError())
         .get());
 #else
     return IPC_FAIL(
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -459,20 +459,23 @@ GMPParent::EnsureProcessLoaded()
   nsresult rv = LoadProcess();
 
   return NS_SUCCEEDED(rv);
 }
 
 void
 GMPParent::WriteExtraDataForMinidump()
 {
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1"));
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginFilename"), NS_ConvertUTF16toUTF8(mName));
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginName"), mDisplayName);
-  mCrashReporter->AddNote(NS_LITERAL_CSTRING("PluginVersion"), mVersion);
+  mCrashReporter->AddAnnotation(CrashReporter::Annotation::GMPPlugin, true);
+  mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginFilename,
+                                NS_ConvertUTF16toUTF8(mName));
+  mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginName,
+                                mDisplayName);
+  mCrashReporter->AddAnnotation(CrashReporter::Annotation::PluginVersion,
+                                mVersion);
 }
 
 bool
 GMPParent::GetCrashID(nsString& aResult)
 {
   if (!mCrashReporter) {
     return false;
   }
--- a/toolkit/crashreporter/CrashAnnotations.yaml
+++ b/toolkit/crashreporter/CrashAnnotations.yaml
@@ -227,16 +227,26 @@ FlashProcessDump:
   type: string
 
 GetHGlobalFromStreamFailure:
   description: >
     Error returned when invoking GetHGlobalFromStreamFailure() during the
     creation of an IPC stream proxy.
   type: string
 
+GMPLibraryPath:
+  description: >
+    Holds the path to the GMP plugin library.
+  type: string
+
+GMPPlugin:
+  description: >
+    Set to 1 if the GMP plugin is enabled.
+  type: boolean
+
 GPUProcessLaunchCount:
   description: >
     Number of times the GPU process was launched.
   type: integer
 
 GPUProcessStatus:
   description: >
     Status of the GPU process, can be set to "Running" or "Destroyed"