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

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

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.h
diff --git a/Source/core/dom/PendingScript.h b/Source/core/dom/PendingScript.h
index a5c5855819c11fa1bd04f3e38f9388af6b5d1fb9..95c8b1d003cf96d6a85ad01732775d00ead6fe50 100644
--- a/Source/core/dom/PendingScript.h
+++ b/Source/core/dom/PendingScript.h
@@ -29,6 +29,7 @@
#include "core/fetch/ResourceClient.h"
#include "core/fetch/ResourceOwner.h"
#include "core/fetch/ScriptResource.h"
+#include "platform/heap/Handle.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
#include "wtf/text/TextPosition.h"
@@ -43,7 +44,7 @@ class ScriptResource;
// A ResourcePtr alone does not prevent the underlying Resource
// from purging its data buffer. This class holds a dummy client open for its
// lifetime in order to guarantee that the data buffer will not be purged.
-class PendingScript : public ResourceOwner<ScriptResource> {
+class PendingScript FINAL : public ResourceOwner<ScriptResource> {
public:
PendingScript()
: m_watchingForLoad(false)
@@ -90,15 +91,31 @@ public:
Element* element() const { return m_element.get(); }
void setElement(Element* element) { m_element = element; }
- PassRefPtr<Element> releaseElementAndClear();
+ PassRefPtrWillBeRawPtr<Element> releaseElementAndClear();
void setScriptResource(ScriptResource*);
virtual void notifyFinished(Resource*);
+ void trace(Visitor*);
+
private:
bool m_watchingForLoad;
- RefPtr<Element> m_element;
+ // FIXME: Oilpan: PendingScript must trace its script element, but
+ // turning the object into a GCed object is problematic. Due to
+ // external ownership arrangements: a PendingScript is
+ // conceptually owned by a script runner object, which when
+ // finalized will have to coordinate the release of the pending
+ // script resource with that of its owner/host
+ // (cf. HTMLScriptRunner finalization.) Doing that when host +
+ // owner + PendingScript are all heap allocated and independently
+ // finalized is not easily achieveable, hence we currently keep
+ // PendingScript off heap, along with its immediate owner.
haraken 2014/05/26 01:08:25 Hmm, can we probably address the issue using weak
sof 2014/05/26 09:41:34 If HTMLScriptRunner and HTMLDocumentParser both di
Mads Ager (chromium) 2014/05/26 13:55:36 Yeah, I see the issue. For now I think we need to
sof 2014/05/26 21:10:18 That gave me an idea -- if HTMLScriptRunner is mad
+ //
+ // Do want to trace() PendingScripts, so we do annotate the
+ // element as being a Member, but disable GC plugin checks for it.
+ GC_PLUGIN_IGNORE("357163")
+ RefPtrWillBeMember<Element> m_element;
TextPosition m_startingPosition; // Only used for inline script tags.
};

Powered by Google App Engine
This is Rietveld 408576698