Index: third_party/WebKit/Source/core/dom/PendingScript.h |
diff --git a/third_party/WebKit/Source/core/dom/PendingScript.h b/third_party/WebKit/Source/core/dom/PendingScript.h |
index c36ed8719cd5a0b9646d76a315f2c98e2a979449..d20962f6dba847d340099557dde692034110eef2 100644 |
--- a/third_party/WebKit/Source/core/dom/PendingScript.h |
+++ b/third_party/WebKit/Source/core/dom/PendingScript.h |
@@ -28,18 +28,17 @@ |
#include "bindings/core/v8/ScriptStreamer.h" |
#include "core/CoreExport.h" |
+#include "core/dom/Script.h" |
#include "core/dom/ScriptElementBase.h" |
-#include "core/loader/resource/ScriptResource.h" |
-#include "platform/MemoryCoordinator.h" |
#include "platform/heap/Handle.h" |
-#include "platform/loader/fetch/ResourceOwner.h" |
-#include "wtf/Noncopyable.h" |
+#include "platform/weborigin/KURL.h" |
#include "wtf/text/TextPosition.h" |
namespace blink { |
+class Document; |
class PendingScript; |
-class ClassicScript; |
+class Script; |
class CORE_EXPORT PendingScriptClient : public GarbageCollectedMixin { |
public: |
@@ -54,30 +53,13 @@ class CORE_EXPORT PendingScriptClient : public GarbageCollectedMixin { |
DEFINE_INLINE_VIRTUAL_TRACE() {} |
}; |
-// A container for an external script which may be loaded and executed. |
-// |
-// TODO(kochi): The comment below is from pre-oilpan age and may not be correct |
-// now. |
-// A RefPtr 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 CORE_EXPORT PendingScript final |
- : public GarbageCollectedFinalized<PendingScript>, |
- public ResourceOwner<ScriptResource>, |
- public MemoryCoordinatorClient { |
- USING_GARBAGE_COLLECTED_MIXIN(PendingScript); |
+class CORE_EXPORT PendingScript |
+ : public GarbageCollectedFinalized<PendingScript> { |
USING_PRE_FINALIZER(PendingScript, dispose); |
WTF_MAKE_NONCOPYABLE(PendingScript); |
public: |
- // For script from an external file. |
- static PendingScript* create(ScriptElementBase*, ScriptResource*); |
- // For inline script. |
- static PendingScript* create(ScriptElementBase*, const TextPosition&); |
- |
- static PendingScript* createForTesting(ScriptResource*); |
- |
- ~PendingScript() override; |
+ virtual ~PendingScript(); |
TextPosition startingPosition() const { return m_startingPosition; } |
void markParserBlockingLoadStartTime(); |
@@ -93,36 +75,32 @@ class CORE_EXPORT PendingScript final |
ScriptElementBase* element() const; |
- DECLARE_TRACE(); |
- |
- ClassicScript* getSource(const KURL& documentURL, bool& errorOccurred) const; |
+ virtual ScriptType scriptType() const = 0; |
- void setStreamer(ScriptStreamer*); |
- void streamingFinished(); |
+ DECLARE_VIRTUAL_TRACE(); |
- bool isReady() const; |
- bool errorOccurred() const; |
+ virtual Script* getSource(const KURL& documentURL, |
+ bool& errorOccurred) const = 0; |
+ virtual bool isReady() const = 0; |
+ virtual KURL url() const = 0; |
+ virtual bool isExternal() const = 0; |
+ virtual bool errorOccurred() const = 0; |
+ virtual bool wasCanceled() const = 0; |
+ virtual void startStreamingIfPossible(Document*, ScriptStreamer::Type) = 0; |
- void startStreamingIfPossible(Document*, ScriptStreamer::Type); |
void dispose(); |
- private: |
- PendingScript(ScriptElementBase*, |
- ScriptResource*, |
- const TextPosition&, |
- bool isForTesting = false); |
- PendingScript() = delete; |
+ protected: |
+ PendingScript(ScriptElementBase*, const TextPosition& startingPosition); |
- void checkState() const; |
+ virtual void disposeInternal() = 0; |
- // ScriptResourceClient |
- void notifyFinished(Resource*) override; |
- String debugName() const override { return "PendingScript"; } |
- void notifyAppendData(ScriptResource*) override; |
+ PendingScriptClient* client() { return m_client; } |
+ bool isWatchingForLoad() const { return m_watchingForLoad; } |
- // MemoryCoordinatorClient |
- void onPurgeMemory() override; |
+ virtual void checkState() const = 0; |
+ private: |
bool m_watchingForLoad; |
// |m_element| must points to the corresponding ScriptLoader's |
@@ -131,15 +109,9 @@ class CORE_EXPORT PendingScript final |
Member<ScriptElementBase> m_element; |
TextPosition m_startingPosition; // Only used for inline script tags. |
- bool m_integrityFailure; |
double m_parserBlockingLoadStartTime; |
- Member<ScriptStreamer> m_streamer; |
Member<PendingScriptClient> m_client; |
- |
- // This flag is used to skip non-null checks of |m_element| in unit |
- // tests, because |m_element| can be null in unit tests. |
- const bool m_isForTesting; |
}; |
} // namespace blink |