Backed out changeset abd1b9db4905 (bug 1382768) for leaks in mochitests, e.g. browser_bug822367.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 21 Jul 2017 20:18:44 +0200
changeset 419059 fafcbde047540092ab629013acedb177026660e5
parent 419058 0bbe2f5be04628ff8fe4a31d9979a7f97ae8c0c2
child 419060 098c638791f5e19c1b174c267ae6df2a7075f814
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1382768, 822367
milestone56.0a1
backs outabd1b9db490509a1d029ab438fe8714d28328fe4
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 abd1b9db4905 (bug 1382768) for leaks in mochitests, e.g. browser_bug822367.js. r=backout
dom/performance/Performance.cpp
dom/performance/Performance.h
dom/performance/PerformanceEntry.cpp
dom/performance/PerformanceEntry.h
dom/performance/PerformanceMark.cpp
dom/performance/PerformanceMark.h
dom/performance/PerformanceMeasure.cpp
dom/performance/PerformanceMeasure.h
dom/performance/PerformanceResourceTiming.cpp
dom/performance/PerformanceResourceTiming.h
--- a/dom/performance/Performance.cpp
+++ b/dom/performance/Performance.cpp
@@ -83,17 +83,16 @@ public:
 private:
   bool mEnabled;
   nsCString mPrefName;
 };
 
 } // anonymous namespace
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Performance)
-  NS_INTERFACE_MAP_ENTRY(nsIMemoryReporter)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(Performance,
                                    DOMEventTargetHelper,
                                    mUserEntries,
                                    mResourceEntries);
 
 NS_IMPL_ADDREF_INHERITED(Performance, DOMEventTargetHelper)
@@ -103,28 +102,26 @@ NS_IMPL_RELEASE_INHERITED(Performance, D
 Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow,
                                  nsDOMNavigationTiming* aDOMTiming,
                                  nsITimedChannel* aChannel)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   RefPtr<Performance> performance =
     PerformanceMainThread::Create(aWindow, aDOMTiming, aChannel);
-  RegisterWeakMemoryReporter(performance);
   return performance.forget();
 }
 
 /* static */ already_AddRefed<Performance>
 Performance::CreateForWorker(workers::WorkerPrivate* aWorkerPrivate)
 {
   MOZ_ASSERT(aWorkerPrivate);
   aWorkerPrivate->AssertIsOnWorkerThread();
 
   RefPtr<Performance> performance = new PerformanceWorker(aWorkerPrivate);
-  RegisterWeakMemoryReporter(performance);
   return performance.forget();
 }
 
 Performance::Performance()
   : mResourceTimingBufferSize(kDefaultResourceTimingBufferSize)
   , mPendingNotificationObserversTask(false)
 {
   MOZ_ASSERT(!NS_IsMainThread());
@@ -134,19 +131,17 @@ Performance::Performance(nsPIDOMWindowIn
   : DOMEventTargetHelper(aWindow)
   , mResourceTimingBufferSize(kDefaultResourceTimingBufferSize)
   , mPendingNotificationObserversTask(false)
 {
   MOZ_ASSERT(NS_IsMainThread());
 }
 
 Performance::~Performance()
-{
-  UnregisterWeakMemoryReporter(this);
-}
+{}
 
 DOMHighResTimeStamp
 Performance::Now() const
 {
   TimeDuration duration = TimeStamp::Now() - CreationTimeStamp();
   return RoundTime(duration.ToMilliseconds());
 }
 
@@ -573,34 +568,10 @@ Performance::IsObserverEnabled(JSContext
 }
 
 void
 Performance::MemoryPressure()
 {
   mUserEntries.Clear();
 }
 
-NS_IMETHODIMP
-Performance::CollectReports(nsIHandleReportCallback* aHandleReport,
-                            nsISupports* aData, bool aAnonymize)
-{
-  size_t userEntries = 0;
-  for (const PerformanceEntry* entry : mUserEntries) {
-    userEntries += entry->SizeOfIncludingThis(MallocSizeOf);
-  }
-
-  MOZ_COLLECT_REPORT(
-    "explicit/dom/performance/userEntries", KIND_HEAP, UNITS_BYTES,
-    userEntries, "Memory used for performance user entries.");
-
-  size_t resourceEntries = 0;
-  for (const PerformanceEntry* entry : mResourceEntries) {
-    resourceEntries += entry->SizeOfIncludingThis(MallocSizeOf);
-  }
-
-  MOZ_COLLECT_REPORT(
-    "explicit/dom/performance/userEntries", KIND_HEAP, UNITS_BYTES,
-    resourceEntries, "Memory used for performance resource entries.");
-  return NS_OK;
-}
-
 } // dom namespace
 } // mozilla namespace
--- a/dom/performance/Performance.h
+++ b/dom/performance/Performance.h
@@ -6,17 +6,16 @@
 
 #ifndef mozilla_dom_Performance_h
 #define mozilla_dom_Performance_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "nsCOMPtr.h"
 #include "nsDOMNavigationTiming.h"
-#include "nsIMemoryReporter.h"
 
 class nsITimedChannel;
 class nsIHttpChannel;
 
 namespace mozilla {
 
 class ErrorResult;
 
@@ -29,23 +28,19 @@ class PerformanceService;
 class PerformanceTiming;
 
 namespace workers {
 class WorkerPrivate;
 }
 
 // Base class for main-thread and worker Performance API
 class Performance : public DOMEventTargetHelper
-                  , public nsIMemoryReporter
 {
-  MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
-
 public:
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_NSIMEMORYREPORTER
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Performance,
                                            DOMEventTargetHelper)
 
   static bool IsObserverEnabled(JSContext* aCx, JSObject* aGlobal);
 
   static already_AddRefed<Performance>
   CreateForMainThread(nsPIDOMWindowInner* aWindow,
                       nsDOMNavigationTiming* aDOMTiming,
--- a/dom/performance/PerformanceEntry.cpp
+++ b/dom/performance/PerformanceEntry.cpp
@@ -36,21 +36,8 @@ PerformanceEntry::~PerformanceEntry()
 {
 }
 
 JSObject*
 PerformanceEntry::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return mozilla::dom::PerformanceEntryBinding::Wrap(aCx, this, aGivenProto);
 }
-
-size_t
-PerformanceEntry::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return mName.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
-         mEntryType.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
-}
-
-size_t
-PerformanceEntry::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
-}
--- a/dom/performance/PerformanceEntry.h
+++ b/dom/performance/PerformanceEntry.h
@@ -79,21 +79,17 @@ public:
     return 0;
   }
 
   virtual const PerformanceResourceTiming* ToResourceTiming() const
   {
     return nullptr;
   }
 
-  virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
 protected:
-  virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
-
   nsCOMPtr<nsISupports> mParent;
   nsString mName;
   nsString mEntryType;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/performance/PerformanceMark.cpp
+++ b/dom/performance/PerformanceMark.cpp
@@ -24,14 +24,8 @@ PerformanceMark::~PerformanceMark()
 {
 }
 
 JSObject*
 PerformanceMark::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return PerformanceMarkBinding::Wrap(aCx, this, aGivenProto);
 }
-
-size_t
-PerformanceMark::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
-}
--- a/dom/performance/PerformanceMark.h
+++ b/dom/performance/PerformanceMark.h
@@ -22,18 +22,16 @@ public:
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   virtual DOMHighResTimeStamp StartTime() const override
   {
     return mStartTime;
   }
 
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
-
 protected:
   virtual ~PerformanceMark();
   DOMHighResTimeStamp mStartTime;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/performance/PerformanceMeasure.cpp
+++ b/dom/performance/PerformanceMeasure.cpp
@@ -26,14 +26,8 @@ PerformanceMeasure::~PerformanceMeasure(
 {
 }
 
 JSObject*
 PerformanceMeasure::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return PerformanceMeasureBinding::Wrap(aCx, this, aGivenProto);
 }
-
-size_t
-PerformanceMeasure::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
-}
--- a/dom/performance/PerformanceMeasure.h
+++ b/dom/performance/PerformanceMeasure.h
@@ -28,18 +28,16 @@ public:
     return mStartTime;
   }
 
   virtual DOMHighResTimeStamp Duration() const override
   {
     return mDuration;
   }
 
-  size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
-
 protected:
   virtual ~PerformanceMeasure();
   DOMHighResTimeStamp mStartTime;
   DOMHighResTimeStamp mDuration;
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/performance/PerformanceResourceTiming.cpp
+++ b/dom/performance/PerformanceResourceTiming.cpp
@@ -21,17 +21,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_
 NS_INTERFACE_MAP_END_INHERITING(PerformanceEntry)
 
 NS_IMPL_ADDREF_INHERITED(PerformanceResourceTiming, PerformanceEntry)
 NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry)
 
 PerformanceResourceTiming::PerformanceResourceTiming(PerformanceTiming* aPerformanceTiming,
                                                      Performance* aPerformance,
                                                      const nsAString& aName)
-: PerformanceEntry(aPerformance->GetParentObject(), aName, NS_LITERAL_STRING("resource")),
+: PerformanceEntry(aPerformance, aName, NS_LITERAL_STRING("resource")),
   mTiming(aPerformanceTiming),
   mEncodedBodySize(0),
   mTransferSize(0),
   mDecodedBodySize(0)
 {
   MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
 }
 
@@ -46,22 +46,8 @@ PerformanceResourceTiming::StartTime() c
   return startTime ? startTime : mTiming->FetchStartHighRes();
 }
 
 JSObject*
 PerformanceResourceTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return PerformanceResourceTimingBinding::Wrap(aCx, this, aGivenProto);
 }
-
-size_t
-PerformanceResourceTiming::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
-}
-
-size_t
-PerformanceResourceTiming::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
-{
-  return PerformanceEntry::SizeOfExcludingThis(aMallocSizeOf) +
-         mInitiatorType.SizeOfExcludingThisIfUnshared(aMallocSizeOf) +
-         mNextHopProtocol.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
-}
--- a/dom/performance/PerformanceResourceTiming.h
+++ b/dom/performance/PerformanceResourceTiming.h
@@ -163,25 +163,19 @@ public:
     mTransferSize = aTransferSize;
   }
 
   void SetDecodedBodySize(uint64_t aDecodedBodySize)
   {
     mDecodedBodySize = aDecodedBodySize;
   }
 
-  size_t
-  SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
-
 protected:
   virtual ~PerformanceResourceTiming();
 
-  size_t
-  SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
-
   nsString mInitiatorType;
   nsString mNextHopProtocol;
   RefPtr<PerformanceTiming> mTiming;
   uint64_t mEncodedBodySize;
   uint64_t mTransferSize;
   uint64_t mDecodedBodySize;
 };