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

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

Issue 1847823007: Hide PingLoader lifetime implementation detail from outside view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « third_party/WebKit/Source/core/loader/PingLoader.h ('k') | 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/PingLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp
index 1a6d4ac594c36d2068ca2d4035a8357eb6f1eddd..e87262768e3104daf14c384223c9f08c52d4ee9d 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -125,9 +125,9 @@ void PingLoader::start(LocalFrame* frame, ResourceRequest& request, const FetchI
if (MixedContentChecker::shouldBlockFetch(frame, request, request.url()))
return;
- // Leak the ping loader, since it will kill itself as soon as it receives a response.
- RawPtr<PingLoader> loader = new PingLoader(frame, request, initiatorInfo, credentialsAllowed);
- loader->ref();
+ // The loader keeps itself alive until it receives a response and disposes itself.
+ PingLoader* loader = new PingLoader(frame, request, initiatorInfo, credentialsAllowed);
+ ASSERT_UNUSED(loader, loader);
}
PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchInitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed)
@@ -135,6 +135,7 @@ PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchI
, m_timeout(this, &PingLoader::timeout)
, m_url(request.url())
, m_identifier(createUniqueIdentifier())
+ , m_keepAlive(this)
{
frame->loader().client()->didDispatchPingLoader(request.url());
@@ -164,7 +165,7 @@ void PingLoader::dispose()
m_loader->cancel();
m_loader = nullptr;
}
- deref();
+ m_keepAlive.clear();
}
void PingLoader::didReceiveResponse(WebURLLoader*, const WebURLResponse& response)
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698