1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef HTMLImportTreeRoot_h 6 #define HTMLImportTreeRoot_h 7 8 #include "core/html/imports/HTMLImport.h" 9 #include "platform/Timer.h" 10 #include "wtf/PassOwnPtr.h" 11 12 namespace WebCore { 13 14 class HTMLImportChild; 15 16 class HTMLImportTreeRoot : public HTMLImport { 17 public: 18 static PassOwnPtrWillBeRawPtr<HTMLImportTreeRoot> create(Document*); 19 20 virtual ~HTMLImportTreeRoot(); 21 22 // HTMLImport 23 virtual Document* document() const OVERRIDE; 24 virtual bool isDone() const OVERRIDE; 25 virtual void stateWillChange() OVERRIDE; 26 virtual void stateDidChange() OVERRIDE; 27 28 void scheduleRecalcState(); 29 30 HTMLImportChild* add(PassOwnPtrWillBeRawPtr<HTMLImportChild>); 31 HTMLImportChild* find(const KURL&) const; 32 33 virtual void trace(Visitor*) OVERRIDE; 34 35 private: 36 explicit HTMLImportTreeRoot(Document*); 37 38 void recalcTimerFired(Timer<HTMLImportTreeRoot>*); 39 40 RawPtrWillBeMember<Document> m_document; 41 Timer<HTMLImportTreeRoot> m_recalcTimer; 42 43 // List of import which has been loaded or being loaded. 44 typedef WillBeHeapVector<OwnPtrWillBeMember<HTMLImportChild> > ImportList; 45 ImportList m_imports; 46 }; 47 48 DEFINE_TYPE_CASTS(HTMLImportTreeRoot, HTMLImport, import, import->isRoot(), import.isRoot()); 49 50 } 51 52 #endif 53