Bug 1322966 - Cleanup performance.cpp, r=qdot

This commit is contained in:
Andrea Marchesini 2016-12-13 02:27:28 +01:00
Родитель 19c6858cf8
Коммит 3c9042f49b
6 изменённых файлов: 9 добавлений и 47 удалений

Просмотреть файл

@ -2823,8 +2823,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
newInnerWindow->mPerformance =
Performance::CreateForMainThread(newInnerWindow->AsInner(),
currentInner->mPerformance->GetDOMTiming(),
currentInner->mPerformance->GetChannel(),
currentInner->mPerformance->GetParentPerformance());
currentInner->mPerformance->GetChannel());
}
}
@ -4033,22 +4032,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<nsPIDOMWindowOuter> 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);
}
}

Просмотреть файл

@ -103,14 +103,12 @@ NS_IMPL_RELEASE_INHERITED(Performance, DOMEventTargetHelper)
/* static */ already_AddRefed<Performance>
Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
nsITimedChannel* aChannel,
Performance* aParentPerformance)
nsITimedChannel* aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<Performance> performance =
new PerformanceMainThread(aWindow, aDOMTiming, aChannel,
aParentPerformance);
new PerformanceMainThread(aWindow, aDOMTiming, aChannel);
return performance.forget();
}

Просмотреть файл

@ -46,8 +46,7 @@ public:
static already_AddRefed<Performance>
CreateForMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
nsITimedChannel* aChannel,
Performance* aParentPerformance);
nsITimedChannel* aChannel);
static already_AddRefed<Performance>
CreateForWorker(workers::WorkerPrivate* aWorkerPrivate);
@ -104,8 +103,6 @@ public:
virtual nsITimedChannel* GetChannel() const = 0;
virtual Performance* GetParentPerformance() const = 0;
protected:
Performance();
explicit Performance(nsPIDOMWindowInner* aWindow);

Просмотреть файл

@ -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");
}

Просмотреть файл

@ -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<nsITimedChannel> mChannel;
RefPtr<PerformanceTiming> mTiming;
RefPtr<PerformanceNavigation> mNavigation;
RefPtr<Performance> mParentPerformance;
JS::Heap<JSObject*> mMozMemory;
};

Просмотреть файл

@ -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();