Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: Source/core/html/HTMLImportChild.cpp

Issue 135653006: [import] Refactoring: Get rid of BlockedFromCreatingDocument state (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImportChild.h ('k') | Source/core/html/HTMLImportsController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 TemporaryChange<bool> traversing(m_traversingClients, true); 62 TemporaryChange<bool> traversing(m_traversingClients, true);
63 m_clients[i]->importChildWasDestroyed(this); 63 m_clients[i]->importChildWasDestroyed(this);
64 } 64 }
65 } 65 }
66 66
67 void HTMLImportChild::wasAlreadyLoaded() 67 void HTMLImportChild::wasAlreadyLoaded()
68 { 68 {
69 ASSERT(!m_loader); 69 ASSERT(!m_loader);
70 ASSERT(m_clients.size()); 70 ASSERT(m_clients.size());
71 71
72 ensureLoader();
72 loaderWasResolved(); 73 loaderWasResolved();
73 ensureLoader();
74 } 74 }
75 75
76 void HTMLImportChild::startLoading(const ResourcePtr<RawResource>& resource) 76 void HTMLImportChild::startLoading(const ResourcePtr<RawResource>& resource)
77 { 77 {
78 ASSERT(!hasResource()); 78 ASSERT(!hasResource());
79 ASSERT(!m_loader); 79 ASSERT(!m_loader);
80 80
81 if (isCreatedByParser()) { 81 if (isCreatedByParser()) {
82 ASSERT(!m_customElementMicrotaskStep); 82 ASSERT(!m_customElementMicrotaskStep);
83 m_customElementMicrotaskStep = CustomElement::didCreateImport(this); 83 m_customElementMicrotaskStep = CustomElement::didCreateImport(this);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 ASSERT(m_loader->isOwnedBy(this)); 154 ASSERT(m_loader->isOwnedBy(this));
155 m_loader->didFinishParsing(); 155 m_loader->didFinishParsing();
156 } 156 }
157 157
158 // Once all preceding imports are loaded and "document blocking" ends, 158 // Once all preceding imports are loaded and "document blocking" ends,
159 // HTMLImportChild can decide whether it should load the import by itself 159 // HTMLImportChild can decide whether it should load the import by itself
160 // or it can share existing one. 160 // or it can share existing one.
161 void HTMLImportChild::didUnblockFromCreatingDocument() 161 void HTMLImportChild::didUnblockFromCreatingDocument()
162 { 162 {
163 HTMLImport::didUnblockFromCreatingDocument(); 163 HTMLImport::didUnblockFromCreatingDocument();
164 ASSERT(!m_loader || !m_loader->isOwnedBy(this));
165 ensureLoader(); 164 ensureLoader();
166 } 165 }
167 166
168 void HTMLImportChild::didBecomeReady() 167 void HTMLImportChild::didBecomeReady()
169 { 168 {
170 HTMLImport::didBecomeReady(); 169 HTMLImport::didBecomeReady();
171 didFinish(); 170 didFinish();
172 } 171 }
173 172
174 void HTMLImportChild::ensureLoader() 173 void HTMLImportChild::ensureLoader()
(...skipping 22 matching lines...) Expand all
197 m_loader = loader->m_loader; 196 m_loader = loader->m_loader;
198 m_loader->addClient(this); 197 m_loader->addClient(this);
199 root()->blockerGone(); 198 root()->blockerGone();
200 } 199 }
201 200
202 bool HTMLImportChild::isDone() const 201 bool HTMLImportChild::isDone() const
203 { 202 {
204 return m_loader && m_loader->isDone(); 203 return m_loader && m_loader->isDone();
205 } 204 }
206 205
206 bool HTMLImportChild::hasLoader() const
207 {
208 return m_loader;
209 }
210
207 bool HTMLImportChild::ownsLoader() const 211 bool HTMLImportChild::ownsLoader() const
208 { 212 {
209 return m_loader->isOwnedBy(this); 213 return m_loader->isOwnedBy(this);
210 } 214 }
211 215
212 bool HTMLImportChild::loaderHasError() const 216 bool HTMLImportChild::loaderHasError() const
213 { 217 {
214 return m_loader && m_loader->hasError(); 218 return m_loader && m_loader->hasError();
215 } 219 }
216 220
217 221
218 void HTMLImportChild::addClient(HTMLImportChildClient* client) 222 void HTMLImportChild::addClient(HTMLImportChildClient* client)
219 { 223 {
220 ASSERT(!m_traversingClients); 224 ASSERT(!m_traversingClients);
221 ASSERT(!m_clients.contains(client)); 225 ASSERT(!m_clients.contains(client));
222 m_clients.append(client); 226 m_clients.append(client);
223 } 227 }
224 228
225 void HTMLImportChild::removeClient(HTMLImportChildClient* client) 229 void HTMLImportChild::removeClient(HTMLImportChildClient* client)
226 { 230 {
227 ASSERT(!m_traversingClients); 231 ASSERT(!m_traversingClients);
228 size_t i = m_clients.find(client); 232 size_t i = m_clients.find(client);
229 ASSERT(i != kNotFound); 233 ASSERT(i != kNotFound);
230 m_clients.remove(i); 234 m_clients.remove(i);
231 } 235 }
232 236
233 } // namespace WebCore 237 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImportChild.h ('k') | Source/core/html/HTMLImportsController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698