Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: Source/core/dom/PendingScript.cpp

Issue 298863010: Oilpan: have PendingScripts trace their script elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add PendingScript::m_element comment + GC plugin annotation. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/PendingScript.cpp
diff --git a/Source/core/dom/PendingScript.cpp b/Source/core/dom/PendingScript.cpp
index b448c8bd9bfd823a5d7255426a9dcd745171bb04..ec5e7a09d521081e58920ac22050f796dac6df5a 100644
--- a/Source/core/dom/PendingScript.cpp
+++ b/Source/core/dom/PendingScript.cpp
@@ -35,7 +35,7 @@ PendingScript::~PendingScript()
{
}
-PassRefPtr<Element> PendingScript::releaseElementAndClear()
+PassRefPtrWillBeRawPtr<Element> PendingScript::releaseElementAndClear()
{
setScriptResource(0);
m_watchingForLoad = false;
@@ -52,4 +52,20 @@ void PendingScript::notifyFinished(Resource*)
{
}
+void PendingScript::trace(Visitor* visitor)
+{
+ // FIXME: Oilpan: this trace() is for a PendingScript that's not
+ // on the heap -- it is kept by script runner objects
+ // (ScriptRunner and HTMLScriptRunner), which are OwnPtr-kept by
+ // the document and the HTML document parser, respectively. The
+ // reason they are OwnPtrs and not on the heap themselves, is due
+ // to their need to finalize by using their hosts -- something
+ // that's not readily doable if both host and script runner object
+ // are heap allocated.
+ //
+ // Find a better arrangment, or at least clarify that this is the
+ // most practical way to handle such a dependency.
+ visitor->trace(m_element);
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698