Revert of Oilpan: move ScriptLoader to the heap. (patchset #3 id:2 of...

Revert of Oilpan: move ScriptLoader to the heap. (patchset #3 id:2 of https://codereview.chromium.org/660233002/)

Reason for revert:
Depends on https://codereview.chromium.org/656113002 which introduced memory leaks.

Original issue's description:
> Oilpan: move ScriptLoader to the heap.
> 
> So as to be able to trace its PendingScript part object.
> 
> R=haraken
> BUG=
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183909

TBR=oilpan-reviews@chromium.org,haraken@chromium.org,sigbjornf@opera.com
NOTREECHECKS=true
NOTRY=true
BUG=

Review URL: https://codereview.chromium.org/656413003

git-svn-id: svn://svn.chromium.org/blink/trunk@183951 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c70ec791
......@@ -128,6 +128,6 @@ private:
RefPtr<ScriptStreamer> m_streamer;
};
} // namespace blink
}
#endif // PendingScript_h
#endif
......@@ -78,12 +78,6 @@ ScriptLoader::~ScriptLoader()
m_pendingScript.stopWatchingForLoad(this);
}
void ScriptLoader::trace(Visitor* visitor)
{
visitor->trace(m_element);
visitor->trace(m_pendingScript);
}
void ScriptLoader::didNotifySubtreeInsertionsToDocument()
{
if (!m_parserInserted)
......@@ -372,8 +366,7 @@ void ScriptLoader::execute()
ASSERT(m_pendingScript.resource());
bool errorOccurred = false;
ScriptSourceCode source = m_pendingScript.getSource(KURL(), errorOccurred);
RefPtrWillBeRawPtr<Element> element = m_pendingScript.releaseElementAndClear();
ALLOW_UNUSED_LOCAL(element);
RefPtr<Element> element = m_pendingScript.releaseElementAndClear();
if (errorOccurred) {
dispatchErrorEvent();
} else if (!m_resource->wasCanceled()) {
......@@ -456,4 +449,4 @@ ScriptLoader* toScriptLoaderIfPossible(Element* element)
return 0;
}
} // namespace blink
}
......@@ -36,15 +36,10 @@ class ScriptLoaderClient;
class ScriptSourceCode;
class ScriptLoader final : public NoBaseWillBeGarbageCollectedFinalized<ScriptLoader>, private ScriptResourceClient {
class ScriptLoader final : private ScriptResourceClient {
public:
static PassOwnPtrWillBeRawPtr<ScriptLoader> create(Element* element, bool createdByParser, bool isEvaluated)
{
return adoptPtrWillBeNoop(new ScriptLoader(element, createdByParser, isEvaluated));
}
static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool isEvaluated);
virtual ~ScriptLoader();
virtual void trace(Visitor*);
Element* element() const { return m_element; }
......@@ -93,14 +88,10 @@ private:
// ResourceClient
virtual void notifyFinished(Resource*) override;
RawPtrWillBeMember<Element> m_element;
// FIXME: Oilpan: This should become a Member once ResourceClient is moved to the heap.
Element* m_element;
ResourcePtr<ScriptResource> m_resource;
WTF::OrdinalNumber m_startLineNumber;
String m_characterEncoding;
String m_fallbackCharacterEncoding;
PendingScript m_pendingScript;
bool m_parserInserted : 1;
bool m_isExternalScript : 1;
bool m_alreadyStarted : 1;
......@@ -110,10 +101,20 @@ private:
bool m_willExecuteWhenDocumentFinishedParsing : 1;
bool m_forceAsync : 1;
bool m_willExecuteInOrder : 1;
String m_characterEncoding;
String m_fallbackCharacterEncoding;
PendingScript m_pendingScript;
};
ScriptLoader* toScriptLoaderIfPossible(Element*);
} // namespace blink
inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool createdByParser, bool isEvaluated)
{
return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated));
}
}
#endif // ScriptLoader_h
#endif
......@@ -123,7 +123,7 @@ void ScriptRunner::timerFired(Timer<ScriptRunner>* timer)
RefPtrWillBeRawPtr<Document> protect(m_document.get());
WillBeHeapVector<RawPtrWillBeMember<ScriptLoader> > scriptLoaders;
Vector<ScriptLoader*> scriptLoaders;
scriptLoaders.swap(m_scriptsToExecuteSoon);
size_t numInOrderScriptsToExecute = 0;
......
......@@ -69,10 +69,9 @@ private:
void addPendingAsyncScript(ScriptLoader*);
RawPtrWillBeMember<Document> m_document;
WillBeHeapVector<RawPtrWillBeMember<ScriptLoader> > m_scriptsToExecuteInOrder;
// http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
WillBeHeapVector<RawPtrWillBeMember<ScriptLoader> > m_scriptsToExecuteSoon;
WillBeHeapHashSet<RawPtrWillBeMember<ScriptLoader> > m_pendingAsyncScripts;
Vector<ScriptLoader*> m_scriptsToExecuteInOrder;
Vector<ScriptLoader*> m_scriptsToExecuteSoon; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible
HashSet<ScriptLoader*> m_pendingAsyncScripts;
Timer<ScriptRunner> m_timer;
};
......
......@@ -208,10 +208,4 @@ PassRefPtrWillBeRawPtr<Element> HTMLScriptElement::cloneElementWithoutAttributes
return adoptRefWillBeNoop(new HTMLScriptElement(document(), false, m_loader->alreadyStarted()));
}
void HTMLScriptElement::trace(Visitor* visitor)
{
visitor->trace(m_loader);
HTMLElement::trace(visitor);
}
}
......@@ -46,8 +46,6 @@ public:
ScriptLoader* loader() const { return m_loader.get(); }
virtual void trace(Visitor*) override;
private:
HTMLScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted);
......@@ -76,7 +74,7 @@ private:
virtual PassRefPtrWillBeRawPtr<Element> cloneElementWithoutAttributesAndChildren() override;
OwnPtrWillBeMember<ScriptLoader> m_loader;
OwnPtr<ScriptLoader> m_loader;
};
} // namespace blink
......
......@@ -178,10 +178,4 @@ bool SVGScriptElement::isAnimatableAttribute(const QualifiedName& name) const
}
#endif
void SVGScriptElement::trace(Visitor* visitor)
{
visitor->trace(m_loader);
SVGElement::trace(visitor);
}
} // namespace blink
......@@ -46,8 +46,6 @@ public:
virtual bool isAnimatableAttribute(const QualifiedName&) const override;
#endif
virtual void trace(Visitor*) override;
private:
SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted);
virtual ~SVGScriptElement();
......@@ -82,8 +80,9 @@ private:
virtual Timer<SVGElement>* svgLoadEventTimer() override { return &m_svgLoadEventTimer; }
Timer<SVGElement> m_svgLoadEventTimer;
OwnPtrWillBeMember<ScriptLoader> m_loader;
OwnPtr<ScriptLoader> m_loader;
};
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment