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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2179903006: DocumentThreadableLoader should clear its Resource before destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index ff39381267a7782827829431a53b43ba753b8c95..b6823b595c521ef56115e2dde075eb5c82bd2bee 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -353,9 +353,7 @@ void DocumentThreadableLoader::makeCrossOriginAccessRequest(const ResourceReques
DocumentThreadableLoader::~DocumentThreadableLoader()
{
CHECK(!m_client);
-
- // TODO(oilpan): Remove this once DocumentThreadableLoader is once again a ResourceOwner.
- clearResource();
+ DCHECK(!m_resource);
}
void DocumentThreadableLoader::overrideTimeout(unsigned long timeoutMilliseconds)
@@ -420,10 +418,6 @@ void DocumentThreadableLoader::setDefersLoading(bool value)
void DocumentThreadableLoader::clear()
{
m_client = nullptr;
-
- if (!m_async)
- return;
-
m_timeoutTimer.stop();
m_requestStartedSeconds = 0.0;
clearResource();
@@ -799,13 +793,10 @@ void DocumentThreadableLoader::handleSuccessfulFinish(unsigned long identifier,
}
ThreadableLoaderClient* client = m_client;
- m_client = nullptr;
- // Don't clear the resource as the client may need to access the downloaded
- // file which will be released when the resource is destoryed.
- if (m_async) {
- m_timeoutTimer.stop();
- m_requestStartedSeconds = 0.0;
- }
+ // Protect the resource in |didFinishLoading| in order not to release the
+ // downloaded file.
+ Persistent<Resource> resource = m_resource;
+ clear();
client->didFinishLoading(identifier, finishTime);
// |this| may be dead here in async mode.
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698