Chromium Code Reviews| 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..956cc975a14c432b310e98ef0777481f61f21a14 100644 |
| --- a/third_party/WebKit/Source/core/loader/PingLoader.cpp |
| +++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp |
| @@ -187,9 +187,7 @@ class BeaconFormData final : public Beacon { |
| }; |
| class PingLoaderImpl : public GarbageCollectedFinalized<PingLoaderImpl>, |
|
sof
2016/12/12 07:48:21
final
|
| - 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) { |
|
sof
2016/12/12 07:48:21
if (m_frame && m_frame->document()) { ... }
or if
|
| + 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( |