OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef HTMLImportLoader_h | 31 #ifndef HTMLImportLoader_h |
32 #define HTMLImportLoader_h | 32 #define HTMLImportLoader_h |
33 | 33 |
34 #include "core/fetch/RawResource.h" | 34 #include "core/fetch/RawResource.h" |
35 #include "core/fetch/ResourceOwner.h" | 35 #include "core/fetch/ResourceOwner.h" |
| 36 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/PassOwnPtr.h" |
36 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
37 | 39 |
38 namespace WebCore { | 40 namespace WebCore { |
39 | 41 |
| 42 class CustomElementMicrotaskQueue; |
40 class Document; | 43 class Document; |
41 class DocumentWriter; | 44 class DocumentWriter; |
42 class HTMLImportChild; | 45 class HTMLImportChild; |
43 class HTMLImportsController; | 46 class HTMLImportsController; |
44 | 47 |
| 48 |
45 // | 49 // |
46 // Owning imported Document lifetime. It also implements ResourceClient through
ResourceOwner | 50 // Owning imported Document lifetime. It also implements ResourceClient through
ResourceOwner |
47 // to feed fetched bytes to the DocumentWriter of the imported document. | 51 // to feed fetched bytes to the DocumentWriter of the imported document. |
48 // HTMLImportLoader is owned by and shared between HTMLImportChild. | 52 // HTMLImportLoader is owned by and shared between HTMLImportChild. |
49 // | 53 // |
50 // | 54 // |
51 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou
rceOwner<RawResource> { | 55 class HTMLImportLoader FINAL : public RefCounted<HTMLImportLoader>, public Resou
rceOwner<RawResource> { |
52 public: | 56 public: |
53 enum State { | 57 enum State { |
54 StateLoading, | 58 StateLoading, |
(...skipping 11 matching lines...) Expand all Loading... |
66 virtual ~HTMLImportLoader(); | 70 virtual ~HTMLImportLoader(); |
67 | 71 |
68 Document* document() const { return m_importedDocument.get(); } | 72 Document* document() const { return m_importedDocument.get(); } |
69 Document* importedDocument() const; | 73 Document* importedDocument() const; |
70 void addImport(HTMLImportChild*); | 74 void addImport(HTMLImportChild*); |
71 void removeImport(HTMLImportChild*); | 75 void removeImport(HTMLImportChild*); |
72 HTMLImportChild* firstImport() const { return m_imports[0]; } | 76 HTMLImportChild* firstImport() const { return m_imports[0]; } |
73 | 77 |
74 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } | 78 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } |
75 bool hasError() const { return m_state == StateError; } | 79 bool hasError() const { return m_state == StateError; } |
| 80 bool shouldBlockScriptExecution() const; |
76 | 81 |
77 void importDestroyed(); | 82 void importDestroyed(); |
78 void startLoading(const ResourcePtr<RawResource>&); | 83 void startLoading(const ResourcePtr<RawResource>&); |
79 void didFinishParsing(); | 84 void didFinishParsing(); |
80 void didRemoveAllPendingStylesheet(); | 85 void didRemoveAllPendingStylesheet(); |
81 bool isOwnedBy(const HTMLImportChild* import) const { return m_imports[0] ==
import; } | 86 |
| 87 PassRefPtr<CustomElementMicrotaskQueue> microtaskQueue() const; |
82 | 88 |
83 private: | 89 private: |
84 HTMLImportLoader(HTMLImportsController*); | 90 HTMLImportLoader(HTMLImportsController*); |
85 | 91 |
86 // RawResourceClient | 92 // RawResourceClient |
87 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; | 93 virtual void responseReceived(Resource*, const ResourceResponse&) OVERRIDE; |
88 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; | 94 virtual void dataReceived(Resource*, const char* data, int length) OVERRIDE; |
89 virtual void notifyFinished(Resource*) OVERRIDE; | 95 virtual void notifyFinished(Resource*) OVERRIDE; |
90 | 96 |
91 State startWritingAndParsing(const ResourceResponse&); | 97 State startWritingAndParsing(const ResourceResponse&); |
92 State finishWriting(); | 98 State finishWriting(); |
93 State finishParsing(); | 99 State finishParsing(); |
94 State finishLoading(); | 100 State finishLoading(); |
95 | 101 |
96 void setState(State); | 102 void setState(State); |
97 void didFinishLoading(); | 103 void didFinishLoading(); |
98 bool hasPendingResources() const; | 104 bool hasPendingResources() const; |
99 void clear(); | 105 void clear(); |
100 | 106 |
101 HTMLImportsController* m_controller; | 107 HTMLImportsController* m_controller; |
102 Vector<HTMLImportChild*> m_imports; | 108 Vector<HTMLImportChild*> m_imports; |
103 State m_state; | 109 State m_state; |
104 RefPtr<Document> m_importedDocument; | 110 RefPtr<Document> m_importedDocument; |
105 RefPtr<DocumentWriter> m_writer; | 111 RefPtr<DocumentWriter> m_writer; |
| 112 RefPtr<CustomElementMicrotaskQueue> m_microtaskQueue; |
106 }; | 113 }; |
107 | 114 |
108 } // namespace WebCore | 115 } // namespace WebCore |
109 | 116 |
110 #endif // HTMLImportLoader_h | 117 #endif // HTMLImportLoader_h |
OLD | NEW |