From 7ee501103ad2efe1d28ef3c10b4111a685746c06 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 29 Apr 2018 12:07:20 +0200 Subject: Bug 1322966 - Cleanup performance.cpp https://hg.mozilla.org/mozilla-central/rev/0ad76084c4c3 --- dom/base/nsGlobalWindow.cpp | 20 ++------------------ dom/performance/Performance.cpp | 6 ++---- dom/performance/Performance.h | 5 +---- dom/performance/PerformanceMainThread.cpp | 10 +++------- dom/performance/PerformanceMainThread.h | 9 +-------- dom/performance/PerformanceWorker.h | 6 ------ 6 files changed, 9 insertions(+), 47 deletions(-) (limited to 'dom') diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 3d5c44a78..738703ef1 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -3124,8 +3124,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, newInnerWindow->mPerformance = Performance::CreateForMainThread(newInnerWindow->AsInner(), currentInner->mPerformance->GetDOMTiming(), - currentInner->mPerformance->GetChannel(), - currentInner->mPerformance->GetParentPerformance()); + currentInner->mPerformance->GetChannel()); } } @@ -4339,22 +4338,7 @@ nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded() timedChannel = nullptr; } if (timing) { - // If we are dealing with an iframe, we will need the parent's performance - // object (so we can add the iframe as a resource of that page). - Performance* parentPerformance = nullptr; - nsCOMPtr parentWindow = GetScriptableParentOrNull(); - if (parentWindow) { - nsPIDOMWindowInner* parentInnerWindow = nullptr; - if (parentWindow) { - parentInnerWindow = parentWindow->GetCurrentInnerWindow(); - } - if (parentInnerWindow) { - parentPerformance = parentInnerWindow->GetPerformance(); - } - } - mPerformance = - Performance::CreateForMainThread(this, timing, timedChannel, - parentPerformance); + mPerformance = Performance::CreateForMainThread(this, timing, timedChannel); } } diff --git a/dom/performance/Performance.cpp b/dom/performance/Performance.cpp index 497bdea27..074bffe8a 100755 --- a/dom/performance/Performance.cpp +++ b/dom/performance/Performance.cpp @@ -82,14 +82,12 @@ NS_IMPL_RELEASE_INHERITED(Performance, DOMEventTargetHelper) /* static */ already_AddRefed Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow, nsDOMNavigationTiming* aDOMTiming, - nsITimedChannel* aChannel, - Performance* aParentPerformance) + nsITimedChannel* aChannel) { MOZ_ASSERT(NS_IsMainThread()); RefPtr performance = - new PerformanceMainThread(aWindow, aDOMTiming, aChannel, - aParentPerformance); + new PerformanceMainThread(aWindow, aDOMTiming, aChannel); return performance.forget(); } diff --git a/dom/performance/Performance.h b/dom/performance/Performance.h index bc70589a5..6a374c7f0 100644 --- a/dom/performance/Performance.h +++ b/dom/performance/Performance.h @@ -45,8 +45,7 @@ public: static already_AddRefed CreateForMainThread(nsPIDOMWindowInner* aWindow, nsDOMNavigationTiming* aDOMTiming, - nsITimedChannel* aChannel, - Performance* aParentPerformance); + nsITimedChannel* aChannel); static already_AddRefed CreateForWorker(workers::WorkerPrivate* aWorkerPrivate); @@ -101,8 +100,6 @@ public: virtual nsITimedChannel* GetChannel() const = 0; - virtual Performance* GetParentPerformance() const = 0; - protected: Performance(); explicit Performance(nsPIDOMWindowInner* aWindow); diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index fa03408c6..d67c0c906 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -16,8 +16,7 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(PerformanceMainThread) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread, Performance) NS_IMPL_CYCLE_COLLECTION_UNLINK(mTiming, - mNavigation, - mParentPerformance) + mNavigation) tmp->mMozMemory = nullptr; mozilla::DropJSObjects(this); NS_IMPL_CYCLE_COLLECTION_UNLINK_END @@ -25,8 +24,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PerformanceMainThread, Performance) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTiming, - mNavigation, - mParentPerformance) + mNavigation) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END @@ -46,12 +44,10 @@ NS_INTERFACE_MAP_END_INHERITING(Performance) PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow, nsDOMNavigationTiming* aDOMTiming, - nsITimedChannel* aChannel, - Performance* aParentPerformance) + nsITimedChannel* aChannel) : Performance(aWindow) , mDOMTiming(aDOMTiming) , mChannel(aChannel) - , mParentPerformance(aParentPerformance) { MOZ_ASSERT(aWindow, "Parent window object should be provided"); } diff --git a/dom/performance/PerformanceMainThread.h b/dom/performance/PerformanceMainThread.h index 84773f29b..fcaa6b903 100644 --- a/dom/performance/PerformanceMainThread.h +++ b/dom/performance/PerformanceMainThread.h @@ -17,8 +17,7 @@ class PerformanceMainThread final : public Performance public: PerformanceMainThread(nsPIDOMWindowInner* aWindow, nsDOMNavigationTiming* aDOMTiming, - nsITimedChannel* aChannel, - Performance* aParentPerformance); + nsITimedChannel* aChannel); NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread, @@ -51,11 +50,6 @@ public: return mChannel; } - virtual Performance* GetParentPerformance() const override - { - return mParentPerformance; - } - protected: ~PerformanceMainThread(); @@ -77,7 +71,6 @@ protected: nsCOMPtr mChannel; RefPtr mTiming; RefPtr mNavigation; - RefPtr mParentPerformance; JS::Heap mMozMemory; }; diff --git a/dom/performance/PerformanceWorker.h b/dom/performance/PerformanceWorker.h index 7eef0d974..d8635e98a 100644 --- a/dom/performance/PerformanceWorker.h +++ b/dom/performance/PerformanceWorker.h @@ -64,12 +64,6 @@ public: return nullptr; } - virtual Performance* GetParentPerformance() const override - { - MOZ_CRASH("This should not be called on workers."); - return nullptr; - } - protected: ~PerformanceWorker(); -- cgit v1.2.3