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

Unified Diff: Source/core/loader/DocumentLoader.cpp

Issue 19574002: Refactoring: Introduce ResouceLoaderHost interface for unloading ResourceLoader. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/core/loader/DocumentLoader.cpp
diff --git a/Source/core/loader/DocumentLoader.cpp b/Source/core/loader/DocumentLoader.cpp
index 9c60bc98e981671bbe99931f64b16227fb135f75..485a85f0c2393afa8c02b3250bcafbe87ae98ba9 100644
--- a/Source/core/loader/DocumentLoader.cpp
+++ b/Source/core/loader/DocumentLoader.cpp
@@ -307,6 +307,9 @@ void DocumentLoader::notifyFinished(CachedResource* resource)
{
ASSERT_UNUSED(resource, m_mainResource == resource);
ASSERT(m_mainResource);
+
+ RefPtr<DocumentLoader> protect(this);
+
if (!m_mainResource->errorOccurred() && !m_mainResource->wasCanceled()) {
finishedLoading(m_mainResource->loadFinishTime());
return;
@@ -904,7 +907,7 @@ void DocumentLoader::setDefersLoading(bool defers)
// Multiple frames may be loading the same main resource simultaneously. If deferral state changes,
// each frame's DocumentLoader will try to send a setDefersLoading() to the same underlying ResourceLoader. Ensure only
// the "owning" DocumentLoader does so, as setDefersLoading() is not resilient to setting the same value repeatedly.
- if (mainResourceLoader() && mainResourceLoader()->documentLoader() == this)
+ if (mainResourceLoader() && mainResourceLoader()->isLoadedBy(m_cachedResourceLoader.get()))
mainResourceLoader()->setDefersLoading(defers);
setAllDefersLoading(m_resourceLoaders, defers);

Powered by Google App Engine
This is Rietveld 408576698