Backed out changeset 0b6c4c95323e (bug 1380081)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 11 Aug 2017 09:28:16 +0200
changeset 374262 f00f5f041f65f3001b6b0ebf23fd7f963baa6fdd
parent 374261 750dc31d7ee77a328e1fbde3b31d262a8ea33a93
child 374263 6ac0bd6aeda33ab083cca86d36508c8b3d1231b7
push id32318
push userkwierso@gmail.com
push dateFri, 11 Aug 2017 20:16:01 +0000
treeherdermozilla-central@80ff3f300e05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1380081
milestone57.0a1
backs out0b6c4c95323e0892df1acd281326665e23dcc320
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
Backed out changeset 0b6c4c95323e (bug 1380081)
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
gfx/ipc/GPUChild.cpp
gfx/ipc/GPUChild.h
gfx/ipc/PGPU.ipdl
toolkit/components/backgroundhangmonitor/HangDetails.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -5378,24 +5378,8 @@ ContentParent::RecvDeviceReset()
 {
   GPUProcessManager* pm = GPUProcessManager::Get();
   if (pm) {
     pm->SimulateDeviceReset();
   }
 
   return IPC_OK();
 }
-
-mozilla::ipc::IPCResult
-ContentParent::RecvBHRThreadHang(const HangDetails& aDetails)
-{
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (obs) {
-    // Copy the HangDetails recieved over the network into a nsIHangDetails, and
-    // then fire our own observer notification.
-    // XXX: We should be able to avoid this potentially expensive copy here by
-    // moving our deserialized argument.
-    nsCOMPtr<nsIHangDetails> hangDetails =
-      new nsHangDetails(HangDetails(aDetails));
-    obs->NotifyObservers(hangDetails, "bhr-thread-hang", nullptr);
-  }
-  return IPC_OK();
-}
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -1144,19 +1144,16 @@ private:
   virtual mozilla::ipc::IPCResult RecvUpdateChildScalars(
     InfallibleTArray<ScalarAction>&& aScalarActions) override;
   virtual mozilla::ipc::IPCResult RecvUpdateChildKeyedScalars(
     InfallibleTArray<KeyedScalarAction>&& aScalarActions) override;
   virtual mozilla::ipc::IPCResult RecvRecordChildEvents(
     nsTArray<ChildEventData>&& events) override;
   virtual mozilla::ipc::IPCResult RecvRecordDiscardedData(
     const DiscardedData& aDiscardedData) override;
-
-  virtual mozilla::ipc::IPCResult RecvBHRThreadHang(
-    const HangDetails& aHangDetails) override;
 public:
   void SendGetFilesResponseAndForget(const nsID& aID,
                                      const GetFilesResponseResult& aResult);
 
   bool SendRequestMemoryReport(const uint32_t& aGeneration,
                                const bool& aAnonymize,
                                const bool& aMinimizeMemoryUsage,
                                const MaybeFileDesc& aDMDFile) override;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -91,17 +91,16 @@ using mozilla::layers::CompositorOptions
 using struct mozilla::dom::FlyWebPublishOptions from "mozilla/dom/FlyWebPublishOptionsIPCSerializer.h";
 using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
 using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
-using mozilla::HangDetails from "mozilla/HangDetails.h";
 
 union ChromeRegistryItem
 {
     ChromePackage;
     OverrideMapping;
     SubstitutionMapping;
 };
 
@@ -1051,18 +1050,16 @@ parent:
     sync GetA11yContentId() returns (uint32_t aContentId);
     async A11yHandlerControl(uint32_t aPid,
                              IHandlerControlHolder aHandlerControl);
 
     async AddMemoryReport(MemoryReport aReport);
     async FinishMemoryReport(uint32_t aGeneration);
 
     async MaybeReloadPlugins();
-
-    async BHRThreadHang(HangDetails aHangDetails);
 both:
      async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
                         Principal aPrincipal, ClonedMessageData aData);
 
     /**
      * Notify `push-subscription-modified` observers in the parent and child.
      */
     async NotifyPushSubscriptionModifiedObservers(nsCString scope,
--- a/gfx/ipc/GPUChild.cpp
+++ b/gfx/ipc/GPUChild.cpp
@@ -15,17 +15,16 @@
 #include "mozilla/dom/MemoryReportRequest.h"
 #include "mozilla/gfx/gfxVars.h"
 #if defined(XP_WIN)
 # include "mozilla/gfx/DeviceManagerDx.h"
 #endif
 #include "mozilla/ipc/CrashReporterHost.h"
 #include "mozilla/layers/LayerTreeOwnerTracker.h"
 #include "mozilla/Unused.h"
-#include "nsIObserverService.h"
 
 #ifdef MOZ_GECKO_PROFILER
 #include "ProfilerParent.h"
 #endif
 
 namespace mozilla {
 namespace gfx {
 
@@ -283,32 +282,16 @@ GPUChild::RecvUpdateFeature(const Featur
 
 mozilla::ipc::IPCResult
 GPUChild::RecvUsedFallback(const Fallback& aFallback, const nsCString& aMessage)
 {
   gfxConfig::EnableFallback(aFallback, aMessage.get());
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult
-GPUChild::RecvBHRThreadHang(const HangDetails& aDetails)
-{
-  nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-  if (obs) {
-    // Copy the HangDetails recieved over the network into a nsIHangDetails, and
-    // then fire our own observer notification.
-    // XXX: We should be able to avoid this potentially expensive copy here by
-    // moving our deserialized argument.
-    nsCOMPtr<nsIHangDetails> hangDetails =
-      new nsHangDetails(HangDetails(aDetails));
-    obs->NotifyObservers(hangDetails, "bhr-thread-hang", nullptr);
-  }
-  return IPC_OK();
-}
-
 class DeferredDeleteGPUChild : public Runnable
 {
 public:
   explicit DeferredDeleteGPUChild(UniquePtr<GPUChild>&& aChild)
     : Runnable("gfx::DeferredDeleteGPUChild")
     , mChild(Move(aChild))
   {
   }
--- a/gfx/ipc/GPUChild.h
+++ b/gfx/ipc/GPUChild.h
@@ -55,17 +55,16 @@ public:
   void ActorDestroy(ActorDestroyReason aWhy) override;
   mozilla::ipc::IPCResult RecvGraphicsError(const nsCString& aError) override;
   mozilla::ipc::IPCResult RecvNotifyUiObservers(const nsCString& aTopic) override;
   mozilla::ipc::IPCResult RecvNotifyDeviceReset(const GPUDeviceData& aData) override;
   mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport) override;
   mozilla::ipc::IPCResult RecvFinishMemoryReport(const uint32_t& aGeneration) override;
   mozilla::ipc::IPCResult RecvUpdateFeature(const Feature& aFeature, const FeatureFailure& aChange) override;
   mozilla::ipc::IPCResult RecvUsedFallback(const Fallback& aFallback, const nsCString& aMessage) override;
-  mozilla::ipc::IPCResult RecvBHRThreadHang(const HangDetails& aDetails) override;
 
   bool SendRequestMemoryReport(const uint32_t& aGeneration,
                                const bool& aAnonymize,
                                const bool& aMinimizeMemoryUsage,
                                const MaybeFileDesc& aDMDFile);
 
   static void Destroy(UniquePtr<GPUChild>&& aChild);
 
--- a/gfx/ipc/PGPU.ipdl
+++ b/gfx/ipc/PGPU.ipdl
@@ -18,17 +18,16 @@ using mozilla::dom::NativeThreadId from 
 using mozilla::Telemetry::Accumulation from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::KeyedAccumulation from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::KeyedScalarAction from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::ChildEventData from "mozilla/TelemetryComms.h";
 using mozilla::Telemetry::DiscardedData from "mozilla/TelemetryComms.h";
 using mozilla::gfx::Feature from "gfxFeature.h";
 using mozilla::gfx::Fallback from "gfxFallback.h";
-using mozilla::HangDetails from "mozilla/HangDetails.h";
 
 namespace mozilla {
 namespace gfx {
 
 union GfxPrefValue {
   bool;
   int32_t;
   uint32_t;
@@ -120,14 +119,12 @@ child:
   async FinishMemoryReport(uint32_t aGeneration);
 
   // Update the UI process after a feature's status has changed. This is used
   // outside of the normal startup flow.
   async UpdateFeature(Feature aFeature, FeatureFailure aChange);
 
   // Notify about:support/Telemetry that a fallback occurred.
   async UsedFallback(Fallback aFallback, nsCString message);
-
-  async BHRThreadHang(HangDetails aDetails);
 };
 
 } // namespace gfx
 } // namespace mozilla
--- a/toolkit/components/backgroundhangmonitor/HangDetails.cpp
+++ b/toolkit/components/backgroundhangmonitor/HangDetails.cpp
@@ -195,42 +195,16 @@ nsHangDetails::Submit()
   }
 
   RefPtr<nsHangDetails> hangDetails = this;
   nsCOMPtr<nsIRunnable> notifyObservers = NS_NewRunnableFunction("NotifyBHRHangObservers", [hangDetails] {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (os) {
       os->NotifyObservers(hangDetails, "bhr-thread-hang", nullptr);
     }
-
-    // If we're not in the parent process, we might need to transmit our hang
-    // details to another process, so that they can be reported there.
-    switch (XRE_GetProcessType()) {
-    case GeckoProcessType_Content: {
-      auto cc = dom::ContentChild::GetSingleton();
-      if (cc) {
-        Unused << cc->SendBHRThreadHang(hangDetails->mDetails);
-      }
-      break;
-    }
-    case GeckoProcessType_GPU: {
-      auto gp = gfx::GPUParent::GetSingleton();
-      if (gp) {
-        Unused << gp->SendBHRThreadHang(hangDetails->mDetails);
-      }
-      break;
-    }
-    case GeckoProcessType_Default:
-      break;
-    default:
-      // XXX: Consider handling GeckoProcessType_GMPlugin and
-      // GeckoProcessType_Plugin?
-      NS_WARNING("Unsupported BHR process type - discarding hang.");
-      break;
-    }
   });
 
   nsresult rv = SystemGroup::Dispatch(TaskCategory::Other,
                                       notifyObservers.forget());
   MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
 }
 
 NS_IMPL_ISUPPORTS(nsHangDetails, nsIHangDetails)
@@ -261,29 +235,31 @@ ParamTraits<mozilla::HangDetails>::Write
 {
   WriteParam(aMsg, aParam.mDuration);
   WriteParam(aMsg, aParam.mProcess);
   WriteParam(aMsg, aParam.mThreadName);
   WriteParam(aMsg, aParam.mRunnableName);
   WriteParam(aMsg, aParam.mPseudoStack);
 
   // Write out the annotation information
-  {
-    // If we have no annotations, write out a 0-length annotations.
-    if (!aParam.mAnnotations) {
-      WriteParam(aMsg, 0);
-    }
+  // If we have no annotations, write out a 0-length annotations.
+  // XXX: Everything about HangAnnotations is awful.
+  if (!aParam.mAnnotations) {
+    WriteParam(aMsg, (size_t) 0);
+  } else {
     size_t length = aParam.mAnnotations->Count();
     WriteParam(aMsg, length);
     auto enumerator = aParam.mAnnotations->GetEnumerator();
-    nsAutoString key;
-    nsAutoString value;
-    while (enumerator->Next(key, value)) {
-      WriteParam(aMsg, key);
-      WriteParam(aMsg, value);
+    if (enumerator) {
+      nsAutoString key;
+      nsAutoString value;
+      while (enumerator->Next(key, value)) {
+        WriteParam(aMsg, key);
+        WriteParam(aMsg, value);
+      }
     }
   }
 
   // NOTE: ProcessedStack will stop being used for BHR in bug 1367406, so this
   // inline serialization will survive until then.
 
   // Write out the native stack module information
   {