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

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

Issue 2646523002: 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"
38 #include "core/fetch/CrossOriginAccessControl.h" 39 #include "core/fetch/CrossOriginAccessControl.h"
39 #include "core/fetch/FetchContext.h" 40 #include "core/fetch/FetchContext.h"
40 #include "core/fetch/FetchInitiatorTypeNames.h" 41 #include "core/fetch/FetchInitiatorTypeNames.h"
41 #include "core/fetch/FetchUtils.h" 42 #include "core/fetch/FetchUtils.h"
42 #include "core/fetch/ResourceFetcher.h" 43 #include "core/fetch/ResourceFetcher.h"
43 #include "core/fetch/UniqueIdentifier.h" 44 #include "core/fetch/UniqueIdentifier.h"
44 #include "core/fileapi/File.h" 45 #include "core/fileapi/File.h"
45 #include "core/frame/FrameConsole.h" 46 #include "core/frame/FrameConsole.h"
46 #include "core/frame/LocalFrame.h" 47 #include "core/frame/LocalFrame.h"
47 #include "core/frame/csp/ContentSecurityPolicy.h" 48 #include "core/frame/csp/ContentSecurityPolicy.h"
48 #include "core/html/FormData.h" 49 #include "core/html/FormData.h"
49 #include "core/inspector/ConsoleMessage.h" 50 #include "core/inspector/ConsoleMessage.h"
50 #include "core/inspector/InspectorInstrumentation.h" 51 #include "core/inspector/InspectorInstrumentation.h"
51 #include "core/inspector/InspectorTraceEvents.h" 52 #include "core/inspector/InspectorTraceEvents.h"
52 #include "core/loader/FrameLoader.h" 53 #include "core/loader/FrameLoader.h"
53 #include "core/loader/FrameLoaderClient.h" 54 #include "core/loader/FrameLoaderClient.h"
54 #include "core/loader/MixedContentChecker.h" 55 #include "core/loader/MixedContentChecker.h"
55 #include "core/page/Page.h" 56 #include "core/page/Page.h"
57 #include "platform/Timer.h"
56 #include "platform/WebFrameScheduler.h" 58 #include "platform/WebFrameScheduler.h"
57 #include "platform/exported/WrappedResourceRequest.h" 59 #include "platform/exported/WrappedResourceRequest.h"
58 #include "platform/exported/WrappedResourceResponse.h" 60 #include "platform/exported/WrappedResourceResponse.h"
59 #include "platform/network/EncodedFormData.h" 61 #include "platform/network/EncodedFormData.h"
60 #include "platform/network/ParsedContentType.h" 62 #include "platform/network/ParsedContentType.h"
61 #include "platform/network/ResourceError.h" 63 #include "platform/network/ResourceError.h"
62 #include "platform/network/ResourceRequest.h" 64 #include "platform/network/ResourceRequest.h"
63 #include "platform/network/ResourceResponse.h" 65 #include "platform/network/ResourceResponse.h"
64 #include "platform/weborigin/SecurityOrigin.h" 66 #include "platform/weborigin/SecurityOrigin.h"
65 #include "platform/weborigin/SecurityPolicy.h" 67 #include "platform/weborigin/SecurityPolicy.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 void didReceiveResponse(const WebURLResponse&) final; 213 void didReceiveResponse(const WebURLResponse&) final;
212 void didReceiveData(const char*, int) final; 214 void didReceiveData(const char*, int) final;
213 void didFinishLoading(double, int64_t, int64_t encodedDataLength) final; 215 void didFinishLoading(double, int64_t, int64_t encodedDataLength) final;
214 void didFail(const WebURLError&, int64_t, int64_t encodedDataLength) final; 216 void didFail(const WebURLError&, int64_t, int64_t encodedDataLength) final;
215 217
216 void timeout(TimerBase*); 218 void timeout(TimerBase*);
217 219
218 void didFailLoading(LocalFrame*); 220 void didFailLoading(LocalFrame*);
219 221
220 std::unique_ptr<WebURLLoader> m_loader; 222 std::unique_ptr<WebURLLoader> m_loader;
221 Timer<PingLoaderImpl> m_timeout; 223 TaskRunnerTimer<PingLoaderImpl> m_timeout;
222 String m_url; 224 String m_url;
223 unsigned long m_identifier; 225 unsigned long m_identifier;
224 SelfKeepAlive<PingLoaderImpl> m_keepAlive; 226 SelfKeepAlive<PingLoaderImpl> m_keepAlive;
225 AtomicString m_initiator; 227 AtomicString m_initiator;
226 228
227 bool m_isBeacon; 229 bool m_isBeacon;
228 230
229 RefPtr<SecurityOrigin> m_origin; 231 RefPtr<SecurityOrigin> m_origin;
230 CORSEnabled m_corsMode; 232 CORSEnabled m_corsMode;
231 }; 233 };
232 234
233 PingLoaderImpl::PingLoaderImpl(LocalFrame* frame, 235 PingLoaderImpl::PingLoaderImpl(LocalFrame* frame,
234 ResourceRequest& request, 236 ResourceRequest& request,
235 const AtomicString& initiator, 237 const AtomicString& initiator,
236 StoredCredentials credentialsAllowed, 238 StoredCredentials credentialsAllowed,
237 bool isBeacon) 239 bool isBeacon)
238 : ContextClient(frame), 240 : ContextClient(frame),
239 m_timeout(this, &PingLoaderImpl::timeout), 241 m_timeout(TaskRunnerHelper::get(TaskType::Networking, frame),
242 this,
243 &PingLoaderImpl::timeout),
240 m_url(request.url()), 244 m_url(request.url()),
241 m_identifier(createUniqueIdentifier()), 245 m_identifier(createUniqueIdentifier()),
242 m_keepAlive(this), 246 m_keepAlive(this),
243 m_initiator(initiator), 247 m_initiator(initiator),
244 m_isBeacon(isBeacon), 248 m_isBeacon(isBeacon),
245 m_origin(frame->document()->getSecurityOrigin()), 249 m_origin(frame->document()->getSecurityOrigin()),
246 m_corsMode(IsCORSEnabled) { 250 m_corsMode(IsCORSEnabled) {
247 const AtomicString contentType = request.httpContentType(); 251 const AtomicString contentType = request.httpContentType();
248 if (!contentType.isNull() && 252 if (!contentType.isNull() &&
249 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType)) 253 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType))
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 bool PingLoader::sendBeacon(LocalFrame* frame, 572 bool PingLoader::sendBeacon(LocalFrame* frame,
569 int allowance, 573 int allowance,
570 const KURL& beaconURL, 574 const KURL& beaconURL,
571 Blob* data, 575 Blob* data,
572 int& payloadLength) { 576 int& payloadLength) {
573 BeaconBlob beacon(data); 577 BeaconBlob beacon(data);
574 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 578 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
575 } 579 }
576 580
577 } // namespace blink 581 } // 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