Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / ScriptLoader.h
index 3f1c391..7353578 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef ScriptLoader_h
 #define ScriptLoader_h
 
+#include "core/dom/PendingScript.h"
 #include "core/fetch/FetchRequest.h"
 #include "core/fetch/ResourceClient.h"
 #include "core/fetch/ResourcePtr.h"
@@ -35,10 +36,15 @@ class ScriptLoaderClient;
 class ScriptSourceCode;
 
 
-class ScriptLoader FINAL : private ScriptResourceClient {
+class ScriptLoader final : public NoBaseWillBeGarbageCollectedFinalized<ScriptLoader>, private ScriptResourceClient {
 public:
-    static PassOwnPtr<ScriptLoader> create(Element*, bool createdByParser, bool isEvaluated);
+    static PassOwnPtrWillBeRawPtr<ScriptLoader> create(Element* element, bool createdByParser, bool isEvaluated)
+    {
+        return adoptPtrWillBeNoop(new ScriptLoader(element, createdByParser, isEvaluated));
+    }
+
     virtual ~ScriptLoader();
+    virtual void trace(Visitor*);
 
     Element* element() const { return m_element; }
 
@@ -48,7 +54,7 @@ public:
     String scriptCharset() const { return m_characterEncoding; }
     String scriptContent() const;
     void executeScript(const ScriptSourceCode&, double* compilationFinishTime = 0);
-    void execute(ScriptResource*);
+    void execute();
 
     // XML parser calls these
     void dispatchLoadEvent();
@@ -72,6 +78,11 @@ public:
     void handleSourceAttribute(const String& sourceUrl);
     void handleAsyncAttribute();
 
+    bool isReady() const { return m_pendingScript.isReady(); }
+
+    // Clears the connection to the PendingScript (and Element and Resource).
+    void detach();
+
 private:
     ScriptLoader(Element*, bool createdByParser, bool isEvaluated);
 
@@ -79,17 +90,20 @@ private:
     bool isScriptForEventSupported() const;
 
     bool fetchScript(const String& sourceUrl, FetchRequest::DeferOption);
-    void stopLoadRequest();
 
     ScriptLoaderClient* client() const;
 
     // ResourceClient
-    virtual void notifyFinished(Resource*) OVERRIDE;
+    virtual void notifyFinished(Resource*) override;
 
-    // FIXME: Oilpan: This should become a Member once ResourceClient is moved to the heap.
-    Element* m_element;
+    RawPtrWillBeMember<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;
@@ -99,18 +113,10 @@ private:
     bool m_willExecuteWhenDocumentFinishedParsing : 1;
     bool m_forceAsync : 1;
     bool m_willExecuteInOrder : 1;
-    String m_characterEncoding;
-    String m_fallbackCharacterEncoding;
 };
 
 ScriptLoader* toScriptLoaderIfPossible(Element*);
 
-inline PassOwnPtr<ScriptLoader> ScriptLoader::create(Element* element, bool createdByParser, bool isEvaluated)
-{
-    return adoptPtr(new ScriptLoader(element, createdByParser, isEvaluated));
-}
-
-}
-
+} // namespace blink
 
-#endif
+#endif // ScriptLoader_h