Bug 1435263 - Get rid of WorkerPrivateParent template - part 5 - mParent, r=bkelly

This commit is contained in:
Andrea Marchesini 2018-02-08 09:33:33 +01:00
Родитель cbee166ef4
Коммит 707fce6000
2 изменённых файлов: 15 добавлений и 12 удалений

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

@ -1449,7 +1449,7 @@ WorkerPrivateParent<Derived>::GetDocument() const
}
// if we don't have a document, we should query the document
// from the parent in case of a nested worker
WorkerPrivate* parent = mParent;
WorkerPrivate* parent = self->mParent;
while (parent) {
if (parent->mLoadInfo.mWindow) {
return parent->mLoadInfo.mWindow->GetExtantDoc();
@ -1552,7 +1552,7 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
WorkerLoadInfo& aLoadInfo)
: mMutex("WorkerPrivateParent Mutex"),
mCondVar(mMutex, "WorkerPrivateParent CondVar"),
mParent(aParent), mScriptURL(aScriptURL),
mScriptURL(aScriptURL),
mWorkerName(aWorkerName),
mLoadingWorkerScript(false), mParentWindowPausedDepth(0),
mWorkerType(aWorkerType)
@ -2658,8 +2658,9 @@ template <class Derived>
void
WorkerPrivateParent<Derived>::AssertIsOnParentThread() const
{
if (GetParent()) {
GetParent()->AssertIsOnWorkerThread();
WorkerPrivate* self = ParentAsWorkerPrivate();
if (self->GetParent()) {
self->GetParent()->AssertIsOnWorkerThread();
}
else {
AssertIsOnMainThread();
@ -2674,7 +2675,7 @@ WorkerPrivateParent<Derived>::AssertInnerWindowIsCorrect() const
WorkerPrivate* self = ParentAsWorkerPrivate();
// Only care about top level workers from windows.
if (mParent || !self->mLoadInfo.mWindow) {
if (self->mParent || !self->mLoadInfo.mWindow) {
return;
}
@ -2707,6 +2708,7 @@ WorkerPrivate::WorkerPrivate(WorkerPrivate* aParent,
aIsChromeWorker, aWorkerType,
aWorkerName, aServiceWorkerScope,
aLoadInfo)
, mParent(aParent)
, mDebuggerRegistered(false)
, mDebugger(nullptr)
, mJSContext(nullptr)

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

@ -130,7 +130,6 @@ protected:
nsTArray<RefPtr<WorkerRunnable>> mPreStartRunnables;
private:
WorkerPrivate* mParent;
nsString mScriptURL;
// This is the worker name for shared workers and dedicated workers.
nsString mWorkerName;
@ -297,12 +296,6 @@ public:
mQueuedRunnables.AppendElement(aRunnable);
}
WorkerPrivate*
GetParent() const
{
return mParent;
}
bool
IsParentWindowPaused() const
{
@ -467,6 +460,8 @@ class WorkerPrivate : public WorkerPrivateParent<WorkerPrivate>
NoTimer
};
WorkerPrivate* mParent;
// The worker is owned by its thread, which is represented here. This is set
// in Constructor() and emptied by WorkerFinishedRunnable, and conditionally
// traversed by the cycle collector if the busy count is zero.
@ -1114,6 +1109,12 @@ public:
return mIsChromeWorker;
}
WorkerPrivate*
GetParent() const
{
return mParent;
}
bool
IsFrozen() const
{