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

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: Comments addressed. 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
« no previous file with comments | « Source/core/html/imports/HTMLImportsController.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportsController.cpp
diff --git a/Source/core/html/imports/HTMLImportsController.cpp b/Source/core/html/imports/HTMLImportsController.cpp
index 79e821035fd26ca0b2bb522f6e3627a18c32006a..399c6b1a5cc4d4b926da149b6f756ac07da01498 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.clear();
for (size_t i = 0; i < m_loaders.size(); ++i)
m_loaders[i]->importDestroyed();
@@ -94,8 +92,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()->add(child.release());
}
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
@@ -103,7 +100,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 +131,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();
« no previous file with comments | « Source/core/html/imports/HTMLImportsController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698