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

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

Issue 2747203002: Make prepareRequest() a separate callback of FetchContext (Closed)
Patch Set: addressed comments Created 3 years, 9 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
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 m_corsMode(IsCORSEnabled) { 246 m_corsMode(IsCORSEnabled) {
247 const AtomicString contentType = request.httpContentType(); 247 const AtomicString contentType = request.httpContentType();
248 if (!contentType.isNull() && 248 if (!contentType.isNull() &&
249 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType)) 249 FetchUtils::isSimpleHeader(AtomicString("content-type"), contentType))
250 m_corsMode = NotCORSEnabled; 250 m_corsMode = NotCORSEnabled;
251 251
252 frame->loader().client()->didDispatchPingLoader(request.url()); 252 frame->loader().client()->didDispatchPingLoader(request.url());
253 253
254 FetchContext& fetchContext = frame->document()->fetcher()->context(); 254 FetchContext& fetchContext = frame->document()->fetcher()->context();
255 255
256 fetchContext.willStartLoadingResource( 256 fetchContext.prepareRequest(request,
257 m_identifier, request, Resource::Image, initiator, 257 FetchContext::RedirectType::kNotForRedirect);
258 FetchContext::V8ActivityLoggingPolicy::Log); 258 fetchContext.recordLoadingActivity(m_identifier, request, Resource::Image,
259 initiator);
259 260
260 FetchInitiatorInfo initiatorInfo; 261 FetchInitiatorInfo initiatorInfo;
261 initiatorInfo.name = initiator; 262 initiatorInfo.name = initiator;
262 fetchContext.dispatchWillSendRequest(m_identifier, request, 263 fetchContext.dispatchWillSendRequest(m_identifier, request,
263 ResourceResponse(), initiatorInfo); 264 ResourceResponse(), initiatorInfo);
264 265
265 // Make sure the scheduler doesn't wait for the ping. 266 // Make sure the scheduler doesn't wait for the ping.
266 if (frame->frameScheduler()) 267 if (frame->frameScheduler())
267 frame->frameScheduler()->didStopLoading(m_identifier); 268 frame->frameScheduler()->didStopLoading(m_identifier);
268 269
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return false; 326 return false;
326 } 327 }
327 } 328 }
328 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of 329 // FIXME: http://crbug.com/427429 is needed to correctly propagate updates of
329 // Origin: following this successful redirect. 330 // Origin: following this successful redirect.
330 331
331 if (frame() && frame()->document()) { 332 if (frame() && frame()->document()) {
332 FetchInitiatorInfo initiatorInfo; 333 FetchInitiatorInfo initiatorInfo;
333 initiatorInfo.name = m_initiator; 334 initiatorInfo.name = m_initiator;
334 FetchContext& fetchContext = frame()->document()->fetcher()->context(); 335 FetchContext& fetchContext = frame()->document()->fetcher()->context();
336 fetchContext.prepareRequest(passedNewRequest.toMutableResourceRequest(),
337 FetchContext::RedirectType::kForRedirect);
335 fetchContext.dispatchWillSendRequest( 338 fetchContext.dispatchWillSendRequest(
336 m_identifier, passedNewRequest.toMutableResourceRequest(), 339 m_identifier, passedNewRequest.toMutableResourceRequest(),
337 passedRedirectResponse.toResourceResponse(), initiatorInfo); 340 passedRedirectResponse.toResourceResponse(), initiatorInfo);
338 } 341 }
339 342
340 return true; 343 return true;
341 } 344 }
342 345
343 void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) { 346 void PingLoaderImpl::didReceiveResponse(const WebURLResponse& response) {
344 if (frame()) { 347 if (frame()) {
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 bool PingLoader::sendBeacon(LocalFrame* frame, 567 bool PingLoader::sendBeacon(LocalFrame* frame,
565 int allowance, 568 int allowance,
566 const KURL& beaconURL, 569 const KURL& beaconURL,
567 Blob* data, 570 Blob* data,
568 int& payloadLength) { 571 int& payloadLength) {
569 BeaconBlob beacon(data); 572 BeaconBlob beacon(data);
570 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 573 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
571 } 574 }
572 575
573 } // namespace blink 576 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698