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) |