Chromium Code Reviews| 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. |
| }; |