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

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

Issue 305723004: Make HTMLImportTreeNode own the whole import tree. (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 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 43eacf5175b9af7d91705fbc5a0477631ff94eef..ac6af0957dd54886b5af036d084b310d57ba2417 100644
--- a/Source/core/html/imports/HTMLImportsController.cpp
+++ b/Source/core/html/imports/HTMLImportsController.cpp
@@ -62,9 +62,7 @@ HTMLImportsController::~HTMLImportsController()
void HTMLImportsController::clear()
{
- for (size_t i = 0; i < m_imports.size(); ++i)
- m_imports[i]->importDestroyed();
- m_imports.clear();
+ m_root = 0;
for (size_t i = 0; i < m_loaders.size(); ++i)
m_loaders[i]->importDestroyed();
@@ -73,8 +71,6 @@ void HTMLImportsController::clear()
if (m_master)
m_master->setImportsController(0);
m_master = 0;
-
- m_root = 0;
}
static bool makesCycle(HTMLImport* parent, const KURL& url)
@@ -94,8 +90,7 @@ HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImportL
child->setClient(client);
parent->appendImport(child.get());
loader->addImport(child.get());
- m_imports.append(child.release());
- return m_imports.last().get();
+ return root()->keep(child.release());
}
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
@@ -103,7 +98,7 @@ HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChild
ASSERT(!request.url().isEmpty() && request.url().isValid());
ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));
- if (HTMLImportChild* childToShareWith = findLinkFor(request.url())) {
+ if (HTMLImportChild* childToShareWith = root()->find(request.url())) {
HTMLImportLoader* loader = childToShareWith->loader();
ASSERT(loader);
HTMLImportChild* child = createChild(request.url(), loader, parent, client);
@@ -134,17 +129,6 @@ void HTMLImportsController::showSecurityErrorMessage(const String& message)
m_master->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
}
-HTMLImportChild* HTMLImportsController::findLinkFor(const KURL& url) const
-{
- for (size_t i = 0; i < m_imports.size(); ++i) {
- HTMLImportChild* candidate = m_imports[i].get();
- if (equalIgnoringFragmentIdentifier(candidate->url(), url) && candidate->loader())
- return candidate;
- }
-
- return 0;
-}
-
SecurityOrigin* HTMLImportsController::securityOrigin() const
{
return m_master->securityOrigin();

Powered by Google App Engine
This is Rietveld 408576698