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

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

Issue 272243004: HTML Imports: Fix race conditions on HTMLImportsChild (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 Document* HTMLImportChild::document() const 134 Document* HTMLImportChild::document() const
135 { 135 {
136 return m_loader ? m_loader->document() : 0; 136 return m_loader ? m_loader->document() : 0;
137 } 137 }
138 138
139 void HTMLImportChild::stateWillChange() 139 void HTMLImportChild::stateWillChange()
140 { 140 {
141 toHTMLImportsController(root())->scheduleRecalcState(); 141 toHTMLImportsController(root())->scheduleRecalcState();
142 ensureLoader();
142 } 143 }
143 144
144 void HTMLImportChild::stateDidChange() 145 void HTMLImportChild::stateDidChange()
145 { 146 {
146 HTMLImport::stateDidChange(); 147 HTMLImport::stateDidChange();
147 148
148 ensureLoader();
149 if (state().isReady()) 149 if (state().isReady())
150 didFinish(); 150 didFinish();
151 } 151 }
152 152
153 void HTMLImportChild::ensureLoader() 153 void HTMLImportChild::ensureLoader()
154 { 154 {
155 if (m_loader) 155 if (m_loader)
156 return; 156 return;
157 157
158 if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_ url, this)) 158 if (HTMLImportChild* found = toHTMLImportsController(root())->findLinkFor(m_ url, this))
(...skipping 18 matching lines...) Expand all
177 void HTMLImportChild::shareLoader(HTMLImportChild* loader) 177 void HTMLImportChild::shareLoader(HTMLImportChild* loader)
178 { 178 {
179 ASSERT(!m_loader); 179 ASSERT(!m_loader);
180 m_loader = loader->m_loader; 180 m_loader = loader->m_loader;
181 m_loader->addImport(this); 181 m_loader->addImport(this);
182 stateWillChange(); 182 stateWillChange();
183 } 183 }
184 184
185 bool HTMLImportChild::isDone() const 185 bool HTMLImportChild::isDone() const
186 { 186 {
187 return m_loader && m_loader->isDone() && !m_customElementMicrotaskStep; 187 return m_loader && m_loader->isDone() && !m_loader->microtaskQueue()->needsP rocessOrStop() && !m_customElementMicrotaskStep;
188 } 188 }
189 189
190 bool HTMLImportChild::loaderHasError() const 190 bool HTMLImportChild::loaderHasError() const
191 { 191 {
192 return m_loader && m_loader->hasError(); 192 return m_loader && m_loader->hasError();
193 } 193 }
194 194
195 195
196 void HTMLImportChild::setClient(HTMLImportChildClient* client) 196 void HTMLImportChild::setClient(HTMLImportChildClient* client)
197 { 197 {
(...skipping 22 matching lines...) Expand all
220 HTMLImport::showThis(); 220 HTMLImport::showThis();
221 fprintf(stderr, " loader=%p step=%p sync=%s url=%s", 221 fprintf(stderr, " loader=%p step=%p sync=%s url=%s",
222 m_loader, 222 m_loader,
223 m_customElementMicrotaskStep.get(), 223 m_customElementMicrotaskStep.get(),
224 isSync() ? "Y" : "N", 224 isSync() ? "Y" : "N",
225 url().string().utf8().data()); 225 url().string().utf8().data());
226 } 226 }
227 #endif 227 #endif
228 228
229 } // namespace WebCore 229 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698