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

Unified Diff: Source/core/dom/Document.cpp

Issue 18467003: Refactoring: Introduce HTMLImport interface to form import tree. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added missing checks and a clearance. Created 7 years, 5 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/dom/Document.h ('k') | Source/core/html/HTMLImport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 32cc098cad82e1349a7e0f62acaff17556d2f9ea..020d825fb203219bf50f9caaf5c42646f6c368f7 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -105,7 +105,7 @@
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLHeadElement.h"
#include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLImportsController.h"
+#include "core/html/HTMLImport.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLNameCollection.h"
#include "core/html/HTMLScriptElement.h"
@@ -441,6 +441,7 @@ Document::Document(Frame* frame, const KURL& url, DocumentClassFlags documentCla
, m_prerenderer(Prerenderer::create(this))
, m_textAutosizer(TextAutosizer::create(this))
, m_pendingTasksTimer(this, &Document::pendingTasksTimerFired)
+ , m_import(0)
, m_scheduledTasksAreSuspended(false)
, m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFired)
#ifndef NDEBUG
@@ -547,6 +548,11 @@ Document::~Document()
if (m_styleSheetList)
m_styleSheetList->detachFromDocument();
+ if (m_import) {
+ m_import->wasDetachedFromDocument();
+ m_import = 0;
+ }
+
m_styleSheetCollection.clear();
if (m_elemSheet)
@@ -592,7 +598,11 @@ void Document::dispose()
detachParser();
m_registrationContext.clear();
- m_imports.clear();
+
+ if (m_import) {
+ m_import->wasDetachedFromDocument();
+ m_import = 0;
+ }
// removeDetachedChildren() doesn't always unregister IDs,
// so tear down scope information upfront to avoid having stale references in the map.
@@ -758,10 +768,10 @@ ScriptValue Document::registerElement(WebCore::ScriptState* state, const AtomicS
return constructorBuilder.bindingsReturnValue();
}
-void Document::setImports(PassRefPtr<HTMLImportsController> imports)
+void Document::setImport(HTMLImport* import)
{
- ASSERT(!m_imports);
- m_imports = imports;
+ ASSERT(!m_import || !import);
+ m_import = import;
}
void Document::didLoadAllImports()
@@ -771,7 +781,7 @@ void Document::didLoadAllImports()
bool Document::haveImportsLoaded() const
{
- return !m_imports || m_imports->haveLoaded();
+ return !m_import || m_import->haveChildrenLoaded();
}
PassRefPtr<DocumentFragment> Document::createDocumentFragment()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/html/HTMLImport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698