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

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

Issue 301803002: Extract tree root responsibility out of HTMLImportsController. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compile. 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') | Source/core/html/imports/LinkImport.cpp » ('j') | 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 551619430e10b831a753606aa879514135bffffe..79e821035fd26ca0b2bb522f6e3627a18c32006a 100644
--- a/Source/core/html/imports/HTMLImportsController.cpp
+++ b/Source/core/html/imports/HTMLImportsController.cpp
@@ -32,12 +32,12 @@
#include "core/html/imports/HTMLImportsController.h"
#include "core/dom/Document.h"
-#include "core/dom/StyleEngine.h"
#include "core/fetch/ResourceFetcher.h"
#include "core/frame/LocalFrame.h"
#include "core/html/imports/HTMLImportChild.h"
#include "core/html/imports/HTMLImportChildClient.h"
#include "core/html/imports/HTMLImportLoader.h"
+#include "core/html/imports/HTMLImportTreeRoot.h"
namespace WebCore {
@@ -50,11 +50,9 @@ void HTMLImportsController::provideTo(Document& master)
}
HTMLImportsController::HTMLImportsController(Document& master)
- : HTMLImport(HTMLImport::Sync)
- , m_master(&master)
- , m_recalcTimer(this, &HTMLImportsController::recalcTimerFired)
+ : m_master(&master)
+ , m_root(HTMLImportTreeRoot::create(&master))
{
- recalcTreeState(this); // This recomputes initial state.
}
HTMLImportsController::~HTMLImportsController()
@@ -76,7 +74,7 @@ void HTMLImportsController::clear()
m_master->setImportsController(0);
m_master = 0;
- m_recalcTimer.stop();
+ m_root.clear();
}
static bool makesCycle(HTMLImport* parent, const KURL& url)
@@ -103,7 +101,7 @@ HTMLImportChild* HTMLImportsController::createChild(const KURL& url, HTMLImportL
HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChildClient* client, FetchRequest request)
{
ASSERT(!request.url().isEmpty() && request.url().isValid());
- ASSERT(parent == this || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));
+ ASSERT(parent == root() || toHTMLImportChild(parent)->loader()->isFirstImport(toHTMLImportChild(parent)));
if (HTMLImportChild* childToShareWith = findLinkFor(request.url())) {
HTMLImportLoader* loader = childToShareWith->loader();
@@ -162,17 +160,12 @@ LocalFrame* HTMLImportsController::frame() const
return m_master->frame();
}
-Document* HTMLImportsController::document() const
-{
- return m_master;
-}
-
bool HTMLImportsController::shouldBlockScriptExecution(const Document& document) const
{
ASSERT(document.importsController() == this);
if (HTMLImportLoader* loader = loaderFor(document))
return loader->shouldBlockScriptExecution();
- return state().shouldBlockScriptExecution();
+ return root()->state().shouldBlockScriptExecution();
}
void HTMLImportsController::wasDetachedFrom(const Document& document)
@@ -182,43 +175,6 @@ void HTMLImportsController::wasDetachedFrom(const Document& document)
clear();
}
-bool HTMLImportsController::isDone() const
-{
- return !m_master->parsing() && m_master->styleEngine()->haveStylesheetsLoaded();
-}
-
-void HTMLImportsController::stateWillChange()
-{
- scheduleRecalcState();
-}
-
-void HTMLImportsController::stateDidChange()
-{
- HTMLImport::stateDidChange();
-
- if (!state().isReady())
- return;
- if (LocalFrame* frame = m_master->frame())
- frame->loader().checkCompleted();
-}
-
-void HTMLImportsController::scheduleRecalcState()
-{
- if (m_recalcTimer.isActive() || !m_master)
- return;
- m_recalcTimer.startOneShot(0, FROM_HERE);
-}
-
-void HTMLImportsController::recalcTimerFired(Timer<HTMLImportsController>*)
-{
- ASSERT(m_master);
-
- do {
- m_recalcTimer.stop();
- HTMLImport::recalcTreeState(this);
- } while (m_recalcTimer.isActive());
-}
-
HTMLImportLoader* HTMLImportsController::createLoader()
{
m_loaders.append(HTMLImportLoader::create(this));
« no previous file with comments | « Source/core/html/imports/HTMLImportsController.h ('k') | Source/core/html/imports/LinkImport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698