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

Unified Diff: Source/core/html/imports/HTMLImportsController.cpp

Issue 238923009: HTML Imports: No more BlockingDocumentCreation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed the build breakage Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/imports/HTMLImportsController.cpp
diff --git a/Source/core/html/imports/HTMLImportsController.cpp b/Source/core/html/imports/HTMLImportsController.cpp
index 42cd73986446a86f3ef96ead626ea902b9045353..9e75672fe8ae1b75af621e71487678765d03c347 100644
--- a/Source/core/html/imports/HTMLImportsController.cpp
+++ b/Source/core/html/imports/HTMLImportsController.cpp
@@ -79,11 +79,22 @@ void HTMLImportsController::clear()
m_recalcTimer.stop();
}
+static bool makesCyclce(HTMLImport* parent, const KURL& url)
dominicc (has gone to gerrit) 2014/04/18 00:56:26 Spelling: cycle
Hajime Morrita 2014/04/18 01:48:33 Done.
+{
+ for (HTMLImport* ancestor = parent; ancestor; ancestor = ancestor->parent()) {
+ if (!ancestor->isRoot() && equalIgnoringFragmentIdentifier(toHTMLImportChild(parent)->url(), url))
+ return true;
+ }
+
+ return false;
+}
+
HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImport* parent, HTMLImportChildClient* client)
{
- OwnPtr<HTMLImportChild> loader = adoptPtr(new HTMLImportChild(*m_master, url, client->isSync() ? HTMLImport::Sync : HTMLImport::Async));
+ HTMLImport::SyncMode mode = client->isSync() && !makesCyclce(parent, url) ? HTMLImport::Sync : HTMLImport::Async;
+ OwnPtr<HTMLImportChild> loader = adoptPtr(new HTMLImportChild(*m_master, url, mode));
loader->setClient(client);
- parent->appendChild(loader.get());
+ parent->appendImport(loader.get());
m_imports.append(loader.release());
return m_imports.last().get();
}
@@ -123,7 +134,7 @@ HTMLImportChild* HTMLImportsController::findLinkFor(const KURL& url, HTMLImport*
{
for (size_t i = 0; i < m_imports.size(); ++i) {
HTMLImportChild* candidate = m_imports[i].get();
- if (candidate != excluding && equalIgnoringFragmentIdentifier(candidate->url(), url) && candidate->hasLoader())
+ if (candidate != excluding && equalIgnoringFragmentIdentifier(candidate->url(), url) && candidate->loader())
return candidate;
}
@@ -154,7 +165,7 @@ bool HTMLImportsController::shouldBlockScriptExecution(const Document& document)
{
ASSERT(document.importsController() == this);
if (HTMLImportLoader* loader = loaderFor(document))
- return loader->firstImport()->state().shouldBlockScriptExecution();
+ return loader->shouldBlockScriptExecution();
return state().shouldBlockScriptExecution();
}
@@ -165,11 +176,6 @@ void HTMLImportsController::wasDetachedFrom(const Document& document)
clear();
}
-bool HTMLImportsController::hasLoader() const
-{
- return true;
-}
-
bool HTMLImportsController::isDone() const
{
return !m_master->parsing() && m_master->styleEngine()->haveStylesheetsLoaded();

Powered by Google App Engine
This is Rietveld 408576698