| 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 eaebdae0d3a76c21aaccaa79d50c79a3c3801a38..d32a134369d0be2abdf6beaad061ffaae2698af7 100644
|
| --- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
|
| +++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
|
| @@ -39,7 +39,6 @@
|
| #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"
|
| @@ -53,12 +52,9 @@
|
| #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"
|
| @@ -68,12 +64,10 @@
|
| #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 {
|
| @@ -193,7 +187,9 @@
|
| };
|
|
|
| class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>,
|
| + public DOMWindowProperty,
|
| private WebURLLoaderClient {
|
| + USING_GARBAGE_COLLECTED_MIXIN(PingLoaderImpl);
|
| WTF_MAKE_NONCOPYABLE(PingLoaderImpl);
|
|
|
| public:
|
| @@ -220,7 +216,6 @@
|
|
|
| void didFailLoading(LocalFrame*);
|
|
|
| - WeakMember<LocalFrame> m_frame;
|
| std::unique_ptr<WebURLLoader> m_loader;
|
| Timer<PingLoaderImpl> m_timeout;
|
| String m_url;
|
| @@ -238,7 +233,7 @@
|
| const AtomicString& initiator,
|
| StoredCredentials credentialsAllowed,
|
| bool isBeacon)
|
| - : m_frame(frame),
|
| + : DOMWindowProperty(frame),
|
| m_timeout(this, &PingLoaderImpl::timeout),
|
| m_url(request.url()),
|
| m_identifier(createUniqueIdentifier()),
|
| @@ -318,9 +313,9 @@
|
| if (!CrossOriginAccessControl::handleRedirect(
|
| m_origin, newRequest, redirectResponse, AllowStoredCredentials,
|
| options, errorDescription)) {
|
| - if (m_frame) {
|
| - if (Document* document = m_frame->document()) {
|
| - document->addConsoleMessage(ConsoleMessage::create(
|
| + if (LocalFrame* localFrame = frame()) {
|
| + if (localFrame->document()) {
|
| + localFrame->document()->addConsoleMessage(ConsoleMessage::create(
|
| JSMessageSource, ErrorMessageLevel, errorDescription));
|
| }
|
| }
|
| @@ -336,31 +331,31 @@
|
| }
|
|
|
| void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
|
| - if (m_frame) {
|
| + if (LocalFrame* frame = this->frame()) {
|
| TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
|
| InspectorResourceFinishEvent::data(m_identifier, 0, true));
|
| const ResourceResponse& resourceResponse = response.toResourceResponse();
|
| - InspectorInstrumentation::didReceiveResourceResponse(
|
| - m_frame, m_identifier, 0, resourceResponse, 0);
|
| - didFailLoading(m_frame);
|
| + InspectorInstrumentation::didReceiveResourceResponse(frame, m_identifier, 0,
|
| + resourceResponse, 0);
|
| + didFailLoading(frame);
|
| }
|
| dispose();
|
| }
|
|
|
| void PingLoaderImpl::didReceiveData(const char*, int) {
|
| - if (m_frame) {
|
| + if (LocalFrame* frame = this->frame()) {
|
| TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
|
| InspectorResourceFinishEvent::data(m_identifier, 0, true));
|
| - didFailLoading(m_frame);
|
| + didFailLoading(frame);
|
| }
|
| dispose();
|
| }
|
|
|
| void PingLoaderImpl::didFinishLoading(double, int64_t, int64_t) {
|
| - if (m_frame) {
|
| + if (LocalFrame* frame = this->frame()) {
|
| TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
|
| InspectorResourceFinishEvent::data(m_identifier, 0, true));
|
| - didFailLoading(m_frame);
|
| + didFailLoading(frame);
|
| }
|
| dispose();
|
| }
|
| @@ -368,19 +363,19 @@
|
| void PingLoaderImpl::didFail(const WebURLError& resourceError,
|
| int64_t,
|
| int64_t) {
|
| - if (m_frame) {
|
| + if (LocalFrame* frame = this->frame()) {
|
| TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
|
| InspectorResourceFinishEvent::data(m_identifier, 0, true));
|
| - didFailLoading(m_frame);
|
| + didFailLoading(frame);
|
| }
|
| dispose();
|
| }
|
|
|
| void PingLoaderImpl::timeout(TimerBase*) {
|
| - if (m_frame) {
|
| + if (LocalFrame* frame = this->frame()) {
|
| TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data",
|
| InspectorResourceFinishEvent::data(m_identifier, 0, true));
|
| - didFailLoading(m_frame);
|
| + didFailLoading(frame);
|
| }
|
| dispose();
|
| }
|
| @@ -393,7 +388,7 @@
|
| }
|
|
|
| DEFINE_TRACE(PingLoaderImpl) {
|
| - visitor->trace(m_frame);
|
| + DOMWindowProperty::trace(visitor);
|
| }
|
|
|
| void finishPingRequestInitialization(
|
|
|