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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (m_customElementMicrotaskStep) | 84 if (m_customElementMicrotaskStep) |
85 CustomElementMicrotaskDispatcher::instance().importDidFinish(m_customEle
mentMicrotaskStep.get()); | 85 CustomElementMicrotaskDispatcher::instance().importDidFinish(m_customEle
mentMicrotaskStep.get()); |
86 } | 86 } |
87 | 87 |
88 void HTMLImportChild::didFinishUpgradingCustomElements() | 88 void HTMLImportChild::didFinishUpgradingCustomElements() |
89 { | 89 { |
90 stateWillChange(); | 90 stateWillChange(); |
91 m_customElementMicrotaskStep.clear(); | 91 m_customElementMicrotaskStep.clear(); |
92 } | 92 } |
93 | 93 |
94 bool HTMLImportChild::isLoaded() const | |
95 { | |
96 return m_loader && m_loader->isDone(); | |
97 } | |
98 | |
99 bool HTMLImportChild::isFirst() const | |
100 { | |
101 return m_loader && m_loader->isFirstImport(this); | |
102 } | |
103 | |
104 void HTMLImportChild::importDestroyed() | 94 void HTMLImportChild::importDestroyed() |
105 { | 95 { |
106 if (parent()) | 96 if (parent()) |
107 parent()->removeChild(this); | 97 parent()->removeChild(this); |
108 if (m_loader) { | 98 |
109 m_loader->removeImport(this); | 99 ASSERT(m_loader); |
110 m_loader = 0; | 100 m_loader->removeImport(this); |
111 } | 101 m_loader = 0; |
112 } | 102 } |
113 | 103 |
114 Document* HTMLImportChild::document() const | 104 Document* HTMLImportChild::document() const |
115 { | 105 { |
116 return m_loader ? m_loader->document() : 0; | 106 ASSERT(m_loader); |
| 107 return m_loader->document(); |
117 } | 108 } |
118 | 109 |
119 void HTMLImportChild::stateWillChange() | 110 void HTMLImportChild::stateWillChange() |
120 { | 111 { |
121 toHTMLImportTreeRoot(root())->scheduleRecalcState(); | 112 toHTMLImportTreeRoot(root())->scheduleRecalcState(); |
122 } | 113 } |
123 | 114 |
124 void HTMLImportChild::stateDidChange() | 115 void HTMLImportChild::stateDidChange() |
125 { | 116 { |
126 HTMLImport::stateDidChange(); | 117 HTMLImport::stateDidChange(); |
(...skipping 19 matching lines...) Expand all Loading... |
146 if (!isDone() && !formsCycle()) { | 137 if (!isDone() && !formsCycle()) { |
147 m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->wea
kPtr(); | 138 m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->wea
kPtr(); |
148 } | 139 } |
149 | 140 |
150 for (HTMLImport* child = firstChild(); child; child = child->next()) | 141 for (HTMLImport* child = firstChild(); child; child = child->next()) |
151 toHTMLImportChild(child)->createCustomElementMicrotaskStepIfNeeded(); | 142 toHTMLImportChild(child)->createCustomElementMicrotaskStepIfNeeded(); |
152 } | 143 } |
153 | 144 |
154 bool HTMLImportChild::isDone() const | 145 bool HTMLImportChild::isDone() const |
155 { | 146 { |
156 return m_loader && m_loader->isDone() && m_loader->microtaskQueue()->isEmpty
() && !m_customElementMicrotaskStep; | 147 ASSERT(m_loader); |
| 148 |
| 149 return m_loader->isDone() && m_loader->microtaskQueue()->isEmpty() && !m_cus
tomElementMicrotaskStep; |
157 } | 150 } |
158 | 151 |
159 bool HTMLImportChild::loaderHasError() const | 152 HTMLImportLoader* HTMLImportChild::loader() const |
160 { | 153 { |
161 return m_loader && m_loader->hasError(); | 154 // This should never be called after importDestroyed. |
| 155 ASSERT(m_loader); |
| 156 return m_loader; |
162 } | 157 } |
163 | 158 |
164 | |
165 void HTMLImportChild::setClient(HTMLImportChildClient* client) | 159 void HTMLImportChild::setClient(HTMLImportChildClient* client) |
166 { | 160 { |
167 ASSERT(client); | 161 ASSERT(client); |
168 ASSERT(!m_client); | 162 ASSERT(!m_client); |
169 m_client = client; | 163 m_client = client; |
170 } | 164 } |
171 | 165 |
172 void HTMLImportChild::clearClient() | 166 void HTMLImportChild::clearClient() |
173 { | 167 { |
174 // Doesn't check m_client nullity because we allow | 168 // Doesn't check m_client nullity because we allow |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 fprintf(stderr, " loader=%p first=%d, step=%p sync=%s url=%s", | 200 fprintf(stderr, " loader=%p first=%d, step=%p sync=%s url=%s", |
207 m_loader, | 201 m_loader, |
208 isFirst, | 202 isFirst, |
209 m_customElementMicrotaskStep.get(), | 203 m_customElementMicrotaskStep.get(), |
210 isSync() ? "Y" : "N", | 204 isSync() ? "Y" : "N", |
211 url().string().utf8().data()); | 205 url().string().utf8().data()); |
212 } | 206 } |
213 #endif | 207 #endif |
214 | 208 |
215 } // namespace WebCore | 209 } // namespace WebCore |
OLD | NEW |