Commit 89aaa753 authored by haraken's avatar haraken Committed by Commit bot

Remove DOMWindowProperty from PingLoaderImpl

PingLoaderImpl just needs a WeakMember<LocalFrame>.
It doesn't need to inherit from DOMWindowProperty.

BUG=610176

Review-Url: https://codereview.chromium.org/2567933003
Cr-Commit-Position: refs/heads/master@{#437894}
parent 140c9756
...@@ -187,9 +187,7 @@ class BeaconFormData final : public Beacon { ...@@ -187,9 +187,7 @@ class BeaconFormData final : public Beacon {
}; };
class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>, class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>,
public DOMWindowProperty,
private WebURLLoaderClient { private WebURLLoaderClient {
USING_GARBAGE_COLLECTED_MIXIN(PingLoaderImpl);
WTF_MAKE_NONCOPYABLE(PingLoaderImpl); WTF_MAKE_NONCOPYABLE(PingLoaderImpl);
public: public:
...@@ -216,6 +214,7 @@ class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>, ...@@ -216,6 +214,7 @@ class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>,
void didFailLoading(LocalFrame*); void didFailLoading(LocalFrame*);
WeakMember<LocalFrame> m_frame;
std::unique_ptr<WebURLLoader> m_loader; std::unique_ptr<WebURLLoader> m_loader;
Timer<PingLoaderImpl> m_timeout; Timer<PingLoaderImpl> m_timeout;
String m_url; String m_url;
...@@ -233,7 +232,7 @@ PingLoaderImpl::PingLoaderImpl(LocalFrame* frame, ...@@ -233,7 +232,7 @@ PingLoaderImpl::PingLoaderImpl(LocalFrame* frame,
const AtomicString& initiator, const AtomicString& initiator,
StoredCredentials credentialsAllowed, StoredCredentials credentialsAllowed,
bool isBeacon) bool isBeacon)
: DOMWindowProperty(frame), : m_frame(frame),
m_timeout(this, &PingLoaderImpl::timeout), m_timeout(this, &PingLoaderImpl::timeout),
m_url(request.url()), m_url(request.url()),
m_identifier(createUniqueIdentifier()), m_identifier(createUniqueIdentifier()),
...@@ -313,9 +312,9 @@ bool PingLoaderImpl::willFollowRedirect( ...@@ -313,9 +312,9 @@ bool PingLoaderImpl::willFollowRedirect(
if (!CrossOriginAccessControl::handleRedirect( if (!CrossOriginAccessControl::handleRedirect(
m_origin, newRequest, redirectResponse, AllowStoredCredentials, m_origin, newRequest, redirectResponse, AllowStoredCredentials,
options, errorDescription)) { options, errorDescription)) {
if (LocalFrame* localFrame = frame()) { if (m_frame) {
if (localFrame->document()) { if (m_frame->document()) {
localFrame->document()->addConsoleMessage(ConsoleMessage::create( m_frame->document()->addConsoleMessage(ConsoleMessage::create(
JSMessageSource, ErrorMessageLevel, errorDescription)); JSMessageSource, ErrorMessageLevel, errorDescription));
} }
} }
...@@ -331,31 +330,31 @@ bool PingLoaderImpl::willFollowRedirect( ...@@ -331,31 +330,31 @@ bool PingLoaderImpl::willFollowRedirect(
} }
void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) { void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
if (LocalFrame* frame = this->frame()) { if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true)); InspectorResourceFinishEvent::data(m_identifier, 0, true));
const ResourceResponse& resourceResponse = response.toResourceResponse(); const ResourceResponse& resourceResponse = response.toResourceResponse();
InspectorInstrumentation::didReceiveResourceResponse(frame, m_identifier, 0, InspectorInstrumentation::didReceiveResourceResponse(
resourceResponse, 0); m_frame, m_identifier, 0, resourceResponse, 0);
didFailLoading(frame); didFailLoading(m_frame);
} }
dispose(); dispose();
} }
void PingLoaderImpl::didReceiveData(const char*, int) { void PingLoaderImpl::didReceiveData(const char*, int) {
if (LocalFrame* frame = this->frame()) { if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true)); InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame); didFailLoading(m_frame);
} }
dispose(); dispose();
} }
void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) { void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
if (LocalFrame* frame = this->frame()) { if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true)); InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame); didFailLoading(m_frame);
} }
dispose(); dispose();
} }
...@@ -363,19 +362,19 @@ void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) { ...@@ -363,19 +362,19 @@ void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
void PingLoaderImpl::didFail(const WebURLError& resourceError, void PingLoaderImpl::didFail(const WebURLError& resourceError,
int64_t, int64_t,
int64_t) { int64_t) {
if (LocalFrame* frame = this->frame()) { if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true)); InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame); didFailLoading(m_frame);
} }
dispose(); dispose();
} }
void PingLoaderImpl::timeout(TimerBase*) { void PingLoaderImpl::timeout(TimerBase*) {
if (LocalFrame* frame = this->frame()) { if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true)); InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame); didFailLoading(m_frame);
} }
dispose(); dispose();
} }
...@@ -388,7 +387,7 @@ void PingLoaderImpl::didFailLoading(LocalFrame* frame) { ...@@ -388,7 +387,7 @@ void PingLoaderImpl::didFailLoading(LocalFrame* frame) {
} }
DEFINE_TRACE(PingLoaderImpl) { DEFINE_TRACE(PingLoaderImpl) {
DOMWindowProperty::trace(visitor); visitor->trace(m_frame);
} }
void finishPingRequestInitialization( void finishPingRequestInitialization(
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/fetch/ResourceLoaderOptions.h" #include "core/fetch/ResourceLoaderOptions.h"
#include "core/frame/DOMWindowProperty.h"
#include "platform/Timer.h" #include "platform/Timer.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "platform/heap/SelfKeepAlive.h" #include "platform/heap/SelfKeepAlive.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment