OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/loader/FrameLoaderClient.h" | 44 #include "core/loader/FrameLoaderClient.h" |
45 #include "core/loader/MixedContentChecker.h" | 45 #include "core/loader/MixedContentChecker.h" |
46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
47 #include "platform/exported/WrappedResourceRequest.h" | 47 #include "platform/exported/WrappedResourceRequest.h" |
48 #include "platform/network/ResourceError.h" | 48 #include "platform/network/ResourceError.h" |
49 #include "platform/network/ResourceRequest.h" | 49 #include "platform/network/ResourceRequest.h" |
50 #include "platform/network/ResourceResponse.h" | 50 #include "platform/network/ResourceResponse.h" |
51 #include "platform/weborigin/SecurityOrigin.h" | 51 #include "platform/weborigin/SecurityOrigin.h" |
52 #include "platform/weborigin/SecurityPolicy.h" | 52 #include "platform/weborigin/SecurityPolicy.h" |
53 #include "public/platform/Platform.h" | 53 #include "public/platform/Platform.h" |
| 54 #include "public/platform/WebFrameScheduler.h" |
54 #include "public/platform/WebURLLoader.h" | 55 #include "public/platform/WebURLLoader.h" |
55 #include "public/platform/WebURLRequest.h" | 56 #include "public/platform/WebURLRequest.h" |
56 #include "public/platform/WebURLResponse.h" | 57 #include "public/platform/WebURLResponse.h" |
57 #include "wtf/PtrUtil.h" | 58 #include "wtf/PtrUtil.h" |
58 | 59 |
59 namespace blink { | 60 namespace blink { |
60 | 61 |
61 static void finishPingRequestInitialization(ResourceRequest& request, LocalFrame
* frame) | 62 static void finishPingRequestInitialization(ResourceRequest& request, LocalFrame
* frame) |
62 { | 63 { |
63 request.setRequestContext(WebURLRequest::RequestContextPing); | 64 request.setRequestContext(WebURLRequest::RequestContextPing); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) | 134 PingLoader::PingLoader(LocalFrame* frame, ResourceRequest& request, const FetchI
nitiatorInfo& initiatorInfo, StoredCredentials credentialsAllowed) |
134 : LocalFrameLifecycleObserver(frame) | 135 : LocalFrameLifecycleObserver(frame) |
135 , m_timeout(this, &PingLoader::timeout) | 136 , m_timeout(this, &PingLoader::timeout) |
136 , m_url(request.url()) | 137 , m_url(request.url()) |
137 , m_identifier(createUniqueIdentifier()) | 138 , m_identifier(createUniqueIdentifier()) |
138 , m_keepAlive(this) | 139 , m_keepAlive(this) |
139 { | 140 { |
140 frame->loader().client()->didDispatchPingLoader(request.url()); | 141 frame->loader().client()->didDispatchPingLoader(request.url()); |
141 frame->document()->fetcher()->context().willStartLoadingResource(m_identifie
r, request, Resource::Image); | 142 frame->document()->fetcher()->context().willStartLoadingResource(m_identifie
r, request, Resource::Image); |
142 frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier
, request, ResourceResponse(), initiatorInfo); | 143 frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier
, request, ResourceResponse(), initiatorInfo); |
| 144 // Make sure the scheduler doesn't wait for the ping. |
| 145 if (frame->frameScheduler()) |
| 146 frame->frameScheduler()->didStopLoading(m_identifier); |
143 | 147 |
144 m_loader = wrapUnique(Platform::current()->createURLLoader()); | 148 m_loader = wrapUnique(Platform::current()->createURLLoader()); |
145 ASSERT(m_loader); | 149 ASSERT(m_loader); |
146 WrappedResourceRequest wrappedRequest(request); | 150 WrappedResourceRequest wrappedRequest(request); |
147 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr
edentials); | 151 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr
edentials); |
148 m_loader->loadAsynchronously(wrappedRequest, this); | 152 m_loader->loadAsynchronously(wrappedRequest, this); |
149 | 153 |
150 // If the server never responds, FrameLoader won't be able to cancel this lo
ad and | 154 // If the server never responds, FrameLoader won't be able to cancel this lo
ad and |
151 // we'll sit here waiting forever. Set a very generous timeout, just in case
. | 155 // we'll sit here waiting forever. Set a very generous timeout, just in case
. |
152 m_timeout.startOneShot(60000, BLINK_FROM_HERE); | 156 m_timeout.startOneShot(60000, BLINK_FROM_HERE); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError:
:cancelledError(m_url)); | 224 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError:
:cancelledError(m_url)); |
221 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError(
m_url)); | 225 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError(
m_url)); |
222 } | 226 } |
223 | 227 |
224 DEFINE_TRACE(PingLoader) | 228 DEFINE_TRACE(PingLoader) |
225 { | 229 { |
226 LocalFrameLifecycleObserver::trace(visitor); | 230 LocalFrameLifecycleObserver::trace(visitor); |
227 } | 231 } |
228 | 232 |
229 } // namespace blink | 233 } // namespace blink |
OLD | NEW |