Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / imports / HTMLImportChild.h
index 54b0a8f..91eb95e 100644 (file)
 #ifndef HTMLImportChild_h
 #define HTMLImportChild_h
 
-#include "core/fetch/RawResource.h"
-#include "core/fetch/ResourceOwner.h"
 #include "core/html/imports/HTMLImport.h"
+#include "platform/heap/Handle.h"
 #include "platform/weborigin/KURL.h"
-#include "wtf/Vector.h"
+#include "wtf/WeakPtr.h"
 
-namespace WebCore {
+namespace blink {
 
 class CustomElementMicrotaskImportStep;
 class HTMLImportLoader;
@@ -46,74 +45,68 @@ class HTMLLinkElement;
 
 //
 // An import tree node subclas to encapsulate imported document
-// lifecycle. This class is owned by LinkStyle. The actual loading
+// lifecycle. This class is owned by HTMLImportsController. The actual loading
 // is done by HTMLImportLoader, which can be shared among multiple
 // HTMLImportChild of same link URL.
 //
-// HTMLImportChild implements ResourceClient through ResourceOwner
-// so that it can speculatively request linked resources while it is unblocked.
-//
-class HTMLImportChild FINAL : public HTMLImport, public ResourceOwner<RawResource> {
+class HTMLImportChild final : public HTMLImport {
 public:
-    HTMLImportChild(Document&, const KURL&, SyncMode);
+    HTMLImportChild(const KURL&, HTMLImportLoader*, SyncMode);
     virtual ~HTMLImportChild();
 
     HTMLLinkElement* link() const;
-    Document* importedDocument() const;
     const KURL& url() const { return m_url; }
 
-    void wasAlreadyLoaded();
-    void startLoading(const ResourcePtr<RawResource>&);
+    void ownerInserted();
+    void didShareLoader();
+    void didStartLoading();
+#if !ENABLE(OILPAN)
     void importDestroyed();
+    WeakPtr<HTMLImportChild> weakPtr() { return m_weakFactory.createWeakPtr(); }
+#endif
 
     // HTMLImport
-    virtual bool isChild() const OVERRIDE { return true; }
-    virtual HTMLImportRoot* root() OVERRIDE;
-    virtual Document* document() const OVERRIDE;
-    virtual void wasDetachedFromDocument() OVERRIDE;
-    virtual void didFinishParsing() OVERRIDE;
-    virtual void didRemoveAllPendingStylesheet() OVERRIDE;
-    virtual bool isDone() const OVERRIDE;
-    virtual bool hasLoader() const OVERRIDE;
-    virtual bool ownsLoader() const OVERRIDE;
-    virtual CustomElementMicrotaskImportStep* customElementMicrotaskStep() const OVERRIDE FINAL { return m_customElementMicrotaskStep; }
-    virtual void stateDidChange() OVERRIDE;
+    virtual Document* document() const override;
+    virtual bool isDone() const override;
+    virtual HTMLImportLoader* loader() const override;
+    virtual void stateWillChange() override;
+    virtual void stateDidChange() override;
+    virtual void trace(Visitor*) override;
 
 #if !defined(NDEBUG)
-    virtual void showThis() OVERRIDE;
+    virtual void showThis() override;
 #endif
 
     void setClient(HTMLImportChildClient*);
+#if !ENABLE(OILPAN)
     void clearClient();
-    bool loaderHasError() const;
+#endif
 
     void didFinishLoading();
+    void didFinishUpgradingCustomElements();
+    void normalize();
 
 private:
-    // RawResourceOwner doing nothing.
-    // HTMLImportChild owns the resource so that the contents of prefetched Resource doesn't go away.
-    virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE { }
-    virtual void dataReceived(Resource*, const char*, int) OVERRIDE { }
-    virtual void notifyFinished(Resource*) OVERRIDE { }
-
     void didFinish();
-    void createLoader();
-    void shareLoader(HTMLImportChild*);
-    void ensureLoader();
+    void shareLoader();
+    void createCustomElementMicrotaskStepIfNeeded();
+    void invalidateCustomElementMicrotaskStep();
 
-    Document& m_master;
     KURL m_url;
-    CustomElementMicrotaskImportStep* m_customElementMicrotaskStep;
-    RefPtr<HTMLImportLoader> m_loader;
-    HTMLImportChildClient* m_client;
+    WeakPtrWillBeWeakMember<CustomElementMicrotaskImportStep> m_customElementMicrotaskStep;
+#if !ENABLE(OILPAN)
+    WeakPtrFactory<HTMLImportChild> m_weakFactory;
+#endif
+    RawPtrWillBeMember<HTMLImportLoader> m_loader;
+    RawPtrWillBeMember<HTMLImportChildClient> m_client;
 };
 
 inline HTMLImportChild* toHTMLImportChild(HTMLImport* import)
 {
-    ASSERT(!import || import->isChild());
+    ASSERT(!import || !import->isRoot());
     return static_cast<HTMLImportChild*>(import);
 }
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // HTMLImportChild_h