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

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

Issue 2567933003: Remove DOMWindowProperty from PingLoaderImpl (Closed)
Patch Set: temp Created 4 years 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 d32a134369d0be2abdf6beaad061ffaae2698af7..eaebdae0d3a76c21aaccaa79d50c79a3c3801a38 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -39,6 +39,7 @@
#include "core/fetch/FetchInitiatorTypeNames.h"
#include "core/fetch/FetchUtils.h"
#include "core/fetch/ResourceFetcher.h"
+#include "core/fetch/ResourceLoaderOptions.h"
#include "core/fetch/UniqueIdentifier.h"
#include "core/fileapi/File.h"
#include "core/frame/FrameConsole.h"
@@ -52,9 +53,12 @@
#include "core/loader/FrameLoaderClient.h"
#include "core/loader/MixedContentChecker.h"
#include "core/page/Page.h"
+#include "platform/Timer.h"
#include "platform/WebFrameScheduler.h"
#include "platform/exported/WrappedResourceRequest.h"
#include "platform/exported/WrappedResourceResponse.h"
+#include "platform/heap/Handle.h"
+#include "platform/heap/SelfKeepAlive.h"
#include "platform/network/EncodedFormData.h"
#include "platform/network/ParsedContentType.h"
#include "platform/network/ResourceError.h"
@@ -64,10 +68,12 @@
#include "platform/weborigin/SecurityPolicy.h"
#include "public/platform/Platform.h"
#include "public/platform/WebURLLoader.h"
+#include "public/platform/WebURLLoaderClient.h"
#include "public/platform/WebURLRequest.h"
#include "public/platform/WebURLResponse.h"
#include "wtf/Compiler.h"
#include "wtf/Functional.h"
+#include "wtf/Noncopyable.h"
#include "wtf/PtrUtil.h"
namespace blink {
@@ -187,9 +193,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 +220,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 +238,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 +318,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 (Document* document = m_frame->document()) {
+ document->addConsoleMessage(ConsoleMessage::create(
JSMessageSource, ErrorMessageLevel, errorDescription));
}
}
@@ -331,31 +336,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 +368,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 +393,7 @@ void PingLoaderImpl::didFailLoading(LocalFrame* frame) {
}
DEFINE_TRACE(PingLoaderImpl) {
- DOMWindowProperty::trace(visitor);
+ visitor->trace(m_frame);
}
void finishPingRequestInitialization(
« 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