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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 StateParsed, | 63 StateParsed, |
64 StateLoaded, | 64 StateLoaded, |
65 StateError | 65 StateError |
66 }; | 66 }; |
67 | 67 |
68 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController
* controller) | 68 static PassOwnPtrWillBeRawPtr<HTMLImportLoader> create(HTMLImportsController
* controller) |
69 { | 69 { |
70 return adoptPtrWillBeNoop(new HTMLImportLoader(controller)); | 70 return adoptPtrWillBeNoop(new HTMLImportLoader(controller)); |
71 } | 71 } |
72 | 72 |
73 virtual ~HTMLImportLoader(); | 73 ~HTMLImportLoader() override; |
74 void dispose(); | 74 void dispose(); |
75 | 75 |
76 Document* document() const { return m_document.get(); } | 76 Document* document() const { return m_document.get(); } |
77 void addImport(HTMLImportChild*); | 77 void addImport(HTMLImportChild*); |
78 void removeImport(HTMLImportChild*); | 78 void removeImport(HTMLImportChild*); |
79 | 79 |
80 void moveToFirst(HTMLImportChild*); | 80 void moveToFirst(HTMLImportChild*); |
81 HTMLImportChild* firstImport() const { return m_imports[0]; } | 81 HTMLImportChild* firstImport() const { return m_imports[0]; } |
82 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si
ze() ? firstImport() == child : false; } | 82 bool isFirstImport(const HTMLImportChild* child) const { return m_imports.si
ze() ? firstImport() == child : false; } |
83 | 83 |
84 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } | 84 bool isDone() const { return m_state == StateLoaded || m_state == StateError
; } |
85 bool hasError() const { return m_state == StateError; } | 85 bool hasError() const { return m_state == StateError; } |
86 bool shouldBlockScriptExecution() const; | 86 bool shouldBlockScriptExecution() const; |
87 | 87 |
88 void startLoading(const ResourcePtr<RawResource>&); | 88 void startLoading(const ResourcePtr<RawResource>&); |
89 | 89 |
90 // Tells the loader that all of the import's stylesheets finished | 90 // Tells the loader that all of the import's stylesheets finished |
91 // loading. | 91 // loading. |
92 // Called by Document::didRemoveAllPendingStylesheet. | 92 // Called by Document::didRemoveAllPendingStylesheet. |
93 void didRemoveAllPendingStylesheet(); | 93 void didRemoveAllPendingStylesheet(); |
94 | 94 |
95 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con
st; | 95 PassRefPtrWillBeRawPtr<CustomElementSyncMicrotaskQueue> microtaskQueue() con
st; |
96 | 96 |
97 DECLARE_VIRTUAL_TRACE(); | 97 DECLARE_VIRTUAL_TRACE(); |
98 | 98 |
99 private: | 99 private: |
100 HTMLImportLoader(HTMLImportsController*); | 100 HTMLImportLoader(HTMLImportsController*); |
101 | 101 |
102 // RawResourceClient | 102 // RawResourceClient |
103 virtual void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr
<WebDataConsumerHandle>) override; | 103 void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr<WebData
ConsumerHandle>) override; |
104 virtual void dataReceived(Resource*, const char* data, unsigned length) over
ride; | 104 void dataReceived(Resource*, const char* data, unsigned length) override; |
105 virtual void notifyFinished(Resource*) override; | 105 void notifyFinished(Resource*) override; |
106 | 106 |
107 // DocumentParserClient | 107 // DocumentParserClient |
108 | 108 |
109 // Called after document parse is complete after DOMContentLoaded was dispat
ched. | 109 // Called after document parse is complete after DOMContentLoaded was dispat
ched. |
110 virtual void notifyParserStopped() override; | 110 void notifyParserStopped() override; |
111 | 111 |
112 State startWritingAndParsing(const ResourceResponse&); | 112 State startWritingAndParsing(const ResourceResponse&); |
113 State finishWriting(); | 113 State finishWriting(); |
114 State finishParsing(); | 114 State finishParsing(); |
115 State finishLoading(); | 115 State finishLoading(); |
116 | 116 |
117 void setState(State); | 117 void setState(State); |
118 void didFinishLoading(); | 118 void didFinishLoading(); |
119 bool hasPendingResources() const; | 119 bool hasPendingResources() const; |
120 #if !ENABLE(OILPAN) | 120 #if !ENABLE(OILPAN) |
121 void clear(); | 121 void clear(); |
122 #endif | 122 #endif |
123 | 123 |
124 RawPtrWillBeMember<HTMLImportsController> m_controller; | 124 RawPtrWillBeMember<HTMLImportsController> m_controller; |
125 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild>> m_imports; | 125 WillBeHeapVector<RawPtrWillBeMember<HTMLImportChild>> m_imports; |
126 State m_state; | 126 State m_state; |
127 RefPtrWillBeMember<Document> m_document; | 127 RefPtrWillBeMember<Document> m_document; |
128 RefPtrWillBeMember<DocumentWriter> m_writer; | 128 RefPtrWillBeMember<DocumentWriter> m_writer; |
129 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue; | 129 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_microtaskQueue; |
130 }; | 130 }; |
131 | 131 |
132 } // namespace blink | 132 } // namespace blink |
133 | 133 |
134 #endif // HTMLImportLoader_h | 134 #endif // HTMLImportLoader_h |
OLD | NEW |