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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/WebURLLoader.h" | 54 #include "public/platform/WebURLLoader.h" |
55 #include "public/platform/WebURLRequest.h" | 55 #include "public/platform/WebURLRequest.h" |
56 #include "public/platform/WebURLResponse.h" | 56 #include "public/platform/WebURLResponse.h" |
57 #include "wtf/OwnPtr.h" | 57 #include "wtf/PtrUtil.h" |
58 | 58 |
59 namespace blink { | 59 namespace blink { |
60 | 60 |
61 static void finishPingRequestInitialization(ResourceRequest& request, LocalFrame
* frame) | 61 static void finishPingRequestInitialization(ResourceRequest& request, LocalFrame
* frame) |
62 { | 62 { |
63 request.setRequestContext(WebURLRequest::RequestContextPing); | 63 request.setRequestContext(WebURLRequest::RequestContextPing); |
64 frame->document()->fetcher()->context().addAdditionalRequestHeaders(request,
FetchSubresource); | 64 frame->document()->fetcher()->context().addAdditionalRequestHeaders(request,
FetchSubresource); |
65 frame->document()->fetcher()->context().setFirstPartyForCookies(request); | 65 frame->document()->fetcher()->context().setFirstPartyForCookies(request); |
66 } | 66 } |
67 | 67 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 : LocalFrameLifecycleObserver(frame) | 134 : LocalFrameLifecycleObserver(frame) |
135 , m_timeout(this, &PingLoader::timeout) | 135 , m_timeout(this, &PingLoader::timeout) |
136 , m_url(request.url()) | 136 , m_url(request.url()) |
137 , m_identifier(createUniqueIdentifier()) | 137 , m_identifier(createUniqueIdentifier()) |
138 , m_keepAlive(this) | 138 , m_keepAlive(this) |
139 { | 139 { |
140 frame->loader().client()->didDispatchPingLoader(request.url()); | 140 frame->loader().client()->didDispatchPingLoader(request.url()); |
141 frame->document()->fetcher()->context().willStartLoadingResource(m_identifie
r, request, Resource::Image); | 141 frame->document()->fetcher()->context().willStartLoadingResource(m_identifie
r, request, Resource::Image); |
142 frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier
, request, ResourceResponse(), initiatorInfo); | 142 frame->document()->fetcher()->context().dispatchWillSendRequest(m_identifier
, request, ResourceResponse(), initiatorInfo); |
143 | 143 |
144 m_loader = adoptPtr(Platform::current()->createURLLoader()); | 144 m_loader = wrapUnique(Platform::current()->createURLLoader()); |
145 ASSERT(m_loader); | 145 ASSERT(m_loader); |
146 WrappedResourceRequest wrappedRequest(request); | 146 WrappedResourceRequest wrappedRequest(request); |
147 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr
edentials); | 147 wrappedRequest.setAllowStoredCredentials(credentialsAllowed == AllowStoredCr
edentials); |
148 m_loader->loadAsynchronously(wrappedRequest, this); | 148 m_loader->loadAsynchronously(wrappedRequest, this); |
149 | 149 |
150 // If the server never responds, FrameLoader won't be able to cancel this lo
ad and | 150 // 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
. | 151 // we'll sit here waiting forever. Set a very generous timeout, just in case
. |
152 m_timeout.startOneShot(60000, BLINK_FROM_HERE); | 152 m_timeout.startOneShot(60000, BLINK_FROM_HERE); |
153 } | 153 } |
154 | 154 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError:
:cancelledError(m_url)); | 219 InspectorInstrumentation::didFailLoading(frame, m_identifier, ResourceError:
:cancelledError(m_url)); |
220 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError(
m_url)); | 220 frame->console().didFailLoading(m_identifier, ResourceError::cancelledError(
m_url)); |
221 } | 221 } |
222 | 222 |
223 DEFINE_TRACE(PingLoader) | 223 DEFINE_TRACE(PingLoader) |
224 { | 224 { |
225 LocalFrameLifecycleObserver::trace(visitor); | 225 LocalFrameLifecycleObserver::trace(visitor); |
226 } | 226 } |
227 | 227 |
228 } // namespace blink | 228 } // namespace blink |
OLD | NEW |