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

Side by Side Diff: third_party/WebKit/Source/core/loader/PingLoader.cpp

Issue 2654463002: Revert of Use TaskRunnerTimer in PingLoader (Closed)
Patch Set: Created 3 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/loader/PingLoader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * 29 *
30 */ 30 */
31 31
32 #include "core/loader/PingLoader.h" 32 #include "core/loader/PingLoader.h"
33 33
34 #include "core/dom/ContextLifecycleObserver.h" 34 #include "core/dom/ContextLifecycleObserver.h"
35 #include "core/dom/DOMArrayBufferView.h" 35 #include "core/dom/DOMArrayBufferView.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/SecurityContext.h" 37 #include "core/dom/SecurityContext.h"
38 #include "core/dom/TaskRunnerHelper.h"
39 #include "core/fetch/CrossOriginAccessControl.h" 38 #include "core/fetch/CrossOriginAccessControl.h"
40 #include "core/fetch/FetchContext.h" 39 #include "core/fetch/FetchContext.h"
41 #include "core/fetch/FetchInitiatorTypeNames.h" 40 #include "core/fetch/FetchInitiatorTypeNames.h"
42 #include "core/fetch/FetchUtils.h" 41 #include "core/fetch/FetchUtils.h"
43 #include "core/fetch/ResourceFetcher.h" 42 #include "core/fetch/ResourceFetcher.h"
44 #include "core/fetch/UniqueIdentifier.h" 43 #include "core/fetch/UniqueIdentifier.h"
45 #include "core/fileapi/File.h" 44 #include "core/fileapi/File.h"
46 #include "core/frame/FrameConsole.h" 45 #include "core/frame/FrameConsole.h"
47 #include "core/frame/LocalFrame.h" 46 #include "core/frame/LocalFrame.h"
48 #include "core/frame/csp/ContentSecurityPolicy.h" 47 #include "core/frame/csp/ContentSecurityPolicy.h"
49 #include "core/html/FormData.h" 48 #include "core/html/FormData.h"
50 #include "core/inspector/ConsoleMessage.h" 49 #include "core/inspector/ConsoleMessage.h"
51 #include "core/inspector/InspectorInstrumentation.h" 50 #include "core/inspector/InspectorInstrumentation.h"
52 #include "core/inspector/InspectorTraceEvents.h" 51 #include "core/inspector/InspectorTraceEvents.h"
53 #include "core/loader/FrameLoader.h" 52 #include "core/loader/FrameLoader.h"
54 #include "core/loader/FrameLoaderClient.h" 53 #include "core/loader/FrameLoaderClient.h"
55 #include "core/loader/MixedContentChecker.h" 54 #include "core/loader/MixedContentChecker.h"
56 #include "core/page/Page.h" 55 #include "core/page/Page.h"
57 #include "platform/Timer.h"
58 #include "platform/WebFrameScheduler.h" 56 #include "platform/WebFrameScheduler.h"
59 #include "platform/exported/WrappedResourceRequest.h" 57 #include "platform/exported/WrappedResourceRequest.h"
60 #include "platform/exported/WrappedResourceResponse.h" 58 #include "platform/exported/WrappedResourceResponse.h"
61 #include "platform/network/EncodedFormData.h" 59 #include "platform/network/EncodedFormData.h"
62 #include "platform/network/ParsedContentType.h" 60 #include "platform/network/ParsedContentType.h"
63 #include "platform/network/ResourceError.h" 61 #include "platform/network/ResourceError.h"
64 #include "platform/network/ResourceRequest.h" 62 #include "platform/network/ResourceRequest.h"
65 #include "platform/network/ResourceResponse.h" 63 #include "platform/network/ResourceResponse.h"
66 #include "platform/weborigin/SecurityOrigin.h" 64 #include "platform/weborigin/SecurityOrigin.h"
67 #include "platform/weborigin/SecurityPolicy.h" 65 #include "platform/weborigin/SecurityPolicy.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 void didReceiveResponse(const WebURLResponse&) final; 211 void didReceiveResponse(const WebURLResponse&) final;
214 void didReceiveData(const char*, int) final; 212 void didReceiveData(const char*, int) final;
215 void didFinishLoading(double, int64_t, int64_t encodedDataLength) final; 213 void didFinishLoading(double, int64_t, int64_t encodedDataLength) final;
216 void didFail(const WebURLError&, int64_t, int64_t encodedDataLength) final; 214 void didFail(const WebURLError&, int64_t, int64_t encodedDataLength) final;
217 215
218 void timeout(TimerBase*); 216 void timeout(TimerBase*);
219 217
220 void didFailLoading(LocalFrame*); 218 void didFailLoading(LocalFrame*);
221 219
222 std::unique_ptr<WebURLLoader> m_loader; 220 std::unique_ptr<WebURLLoader> m_loader;
223 TaskRunnerTimer<PingLoaderImpl> m_timeout; 221 Timer<PingLoaderImpl> m_timeout;
224 String m_url; 222 String m_url;
225 unsigned long m_identifier; 223 unsigned long m_identifier;
226 SelfKeepAlive<PingLoaderImpl> m_keepAlive; 224 SelfKeepAlive<PingLoaderImpl> m_keepAlive;
227 AtomicString m_initiator; 225 AtomicString m_initiator;
228 226
229 bool m_isBeacon; 227 bool m_isBeacon;
230 228
231 RefPtr<SecurityOrigin> m_origin; 229 RefPtr<SecurityOrigin> m_origin;
232 CORSEnabled m_corsMode; 230 CORSEnabled m_corsMode;
233 }; 231 };
234 232
235 PingLoaderImpl::PingLoaderImpl(LocalFrame* frame, 233 PingLoaderImpl::PingLoaderImpl(LocalFrame* frame,
236 ResourceRequest& request, 234 ResourceRequest& request,
237 const AtomicString& initiator, 235 const AtomicString& initiator,
238 StoredCredentials credentialsAllowed, 236 StoredCredentials credentialsAllowed,
239 bool isBeacon) 237 bool isBeacon)
240 : ContextClient(frame), 238 : ContextClient(frame),
241 m_timeout(TaskRunnerHelper::get(TaskType::Networking, frame), 239 m_timeout(this, &PingLoaderImpl::timeout),
242 this,
243 &PingLoaderImpl::timeout),
244 m_url(request.url()), 240 m_url(request.url()),
245 m_identifier(createUniqueIdentifier()), 241 m_identifier(createUniqueIdentifier()),
246 m_keepAlive(this), 242 m_keepAlive(this),
247 m_initiator(initiator), 243 m_initiator(initiator),
248 m_isBeacon(isBeacon), 244 m_isBeacon(isBeacon),
249 m_origin(frame->document()->getSecurityOrigin()), 245 m_origin(frame->document()->getSecurityOrigin()),
250 m_corsMode(IsCORSEnabled) { 246 m_corsMode(IsCORSEnabled) {
251 const AtomicString contentType = request.httpContentType(); 247 const AtomicString contentType = request.httpContentType();
252 if (!contentType.isNull() && 248 if (!contentType.isNull() &&
253 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType)) 249 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType))
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 bool PingLoader::sendBeacon(LocalFrame* frame, 568 bool PingLoader::sendBeacon(LocalFrame* frame,
573 int allowance, 569 int allowance,
574 const KURL& beaconURL, 570 const KURL& beaconURL,
575 Blob* data, 571 Blob* data,
576 int& payloadLength) { 572 int& payloadLength) {
577 BeaconBlob beacon(data); 573 BeaconBlob beacon(data);
578 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 574 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
579 } 575 }
580 576
581 } // namespace blink 577 } // namespace blink
OLDNEW
« 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