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

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

Issue 305743003: HTMLImportsController does not need to hold Document ptr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. 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 399c6b1a5cc4d4b926da149b6f756ac07da01498..1a563f80a1ab55c61ed2c3afea9b65da627531d3 100644
--- a/Source/core/html/imports/HTMLImportsController.cpp
+++ b/Source/core/html/imports/HTMLImportsController.cpp
@@ -50,29 +50,27 @@ void HTMLImportsController::provideTo(Document& master)
}
HTMLImportsController::HTMLImportsController(Document& master)
- : m_master(&master)
- , m_root(HTMLImportTreeRoot::create(&master))
+ : m_root(HTMLImportTreeRoot::create(&master))
{
}
HTMLImportsController::~HTMLImportsController()
{
- ASSERT(!m_master);
+ ASSERT(!m_root);
}
void HTMLImportsController::clear()
{
+ Document* master = root()->document();
m_root.clear();
for (size_t i = 0; i < m_loaders.size(); ++i)
m_loaders[i]->importDestroyed();
m_loaders.clear();
- if (m_master)
- m_master->setImportsController(0);
- m_master = 0;
-
- m_root.clear();
+ if (master)
+ master->setImportsController(0);
+ master = 0;
}
static bool makesCycle(HTMLImport* parent, const KURL& url)
@@ -108,9 +106,9 @@ HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChild
return child;
}
- bool sameOriginRequest = securityOrigin()->canRequest(request.url());
+ bool sameOriginRequest = master()->securityOrigin()->canRequest(request.url());
request.setCrossOriginAccessControl(
- securityOrigin(), sameOriginRequest ? AllowStoredCredentials : DoNotAllowStoredCredentials,
+ master()->securityOrigin(), sameOriginRequest ? AllowStoredCredentials : DoNotAllowStoredCredentials,
ClientDidNotRequestCredentials);
ResourcePtr<RawResource> resource = parent->document()->fetcher()->fetchImport(request);
if (!resource)
@@ -128,22 +126,12 @@ HTMLImportChild* HTMLImportsController::load(HTMLImport* parent, HTMLImportChild
void HTMLImportsController::showSecurityErrorMessage(const String& message)
{
- m_master->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
-}
-
-SecurityOrigin* HTMLImportsController::securityOrigin() const
-{
- return m_master->securityOrigin();
-}
-
-ResourceFetcher* HTMLImportsController::fetcher() const
-{
- return m_master->fetcher();
+ master()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message);
}
-LocalFrame* HTMLImportsController::frame() const
+Document* HTMLImportsController::master() const
{
- return m_master->frame();
+ return root()->document();
}
bool HTMLImportsController::shouldBlockScriptExecution(const Document& document) const
@@ -157,7 +145,7 @@ bool HTMLImportsController::shouldBlockScriptExecution(const Document& document)
void HTMLImportsController::wasDetachedFrom(const Document& document)
{
ASSERT(document.importsController() == this);
- if (m_master == &document)
+ if (master() == &document)
clear();
}
« 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