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 {
};
class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>,
public DOMWindowProperty,
private WebURLLoaderClient {
USING_GARBAGE_COLLECTED_MIXIN(PingLoaderImpl);
WTF_MAKE_NONCOPYABLE(PingLoaderImpl);
public:
......@@ -216,6 +214,7 @@ class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>,
void didFailLoading(LocalFrame*);
WeakMember<LocalFrame> m_frame;
std::unique_ptr<WebURLLoader> m_loader;
Timer<PingLoaderImpl> m_timeout;
String m_url;
......@@ -233,7 +232,7 @@ PingLoaderImpl::PingLoaderImpl(LocalFrame* frame,
const AtomicString& initiator,
StoredCredentials credentialsAllowed,
bool isBeacon)
: DOMWindowProperty(frame),
: m_frame(frame),
m_timeout(this, &PingLoaderImpl::timeout),
m_url(request.url()),
m_identifier(createUniqueIdentifier()),
......@@ -313,9 +312,9 @@ bool PingLoaderImpl::willFollowRedirect(
if (!CrossOriginAccessControl::handleRedirect(
m_origin, newRequest, redirectResponse, AllowStoredCredentials,
options, errorDescription)) {
if (LocalFrame* localFrame = frame()) {
if (localFrame->document()) {
localFrame->document()->addConsoleMessage(ConsoleMessage::create(
if (m_frame) {
if (m_frame->document()) {
m_frame->document()->addConsoleMessage(ConsoleMessage::create(
JSMessageSource, ErrorMessageLevel, errorDescription));
}
}
......@@ -331,31 +330,31 @@ bool PingLoaderImpl::willFollowRedirect(
}
void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
if (LocalFrame* frame = this->frame()) {
if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true));
const ResourceResponse& resourceResponse = response.toResourceResponse();
InspectorInstrumentation::didReceiveResourceResponse(frame, m_identifier, 0,
resourceResponse, 0);
didFailLoading(frame);
InspectorInstrumentation::didReceiveResourceResponse(
m_frame, m_identifier, 0, resourceResponse, 0);
didFailLoading(m_frame);
}
dispose();
}
void PingLoaderImpl::didReceiveData(const char*, int) {
if (LocalFrame* frame = this->frame()) {
if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame);
didFailLoading(m_frame);
}
dispose();
}
void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
if (LocalFrame* frame = this->frame()) {
if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame);
didFailLoading(m_frame);
}
dispose();
}
......@@ -363,19 +362,19 @@ void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
void PingLoaderImpl::didFail(const WebURLError& resourceError,
int64_t,
int64_t) {
if (LocalFrame* frame = this->frame()) {
if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame);
didFailLoading(m_frame);
}
dispose();
}
void PingLoaderImpl::timeout(TimerBase*) {
if (LocalFrame* frame = this->frame()) {
if (m_frame) {
TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
InspectorResourceFinishEvent::data(m_identifier, 0, true));
didFailLoading(frame);
didFailLoading(m_frame);
}
dispose();
}
......@@ -388,7 +387,7 @@ void PingLoaderImpl::didFailLoading(LocalFrame* frame) {
}
DEFINE_TRACE(PingLoaderImpl) {
DOMWindowProperty::trace(visitor);
visitor->trace(m_frame);
}
void finishPingRequestInitialization(
......
......@@ -34,7 +34,6 @@
#include "core/CoreExport.h"
#include "core/fetch/ResourceLoaderOptions.h"
#include "core/frame/DOMWindowProperty.h"
#include "platform/Timer.h"
#include "platform/heap/Handle.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