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

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

Issue 2748463002: Split header modification out of willSendRequest
Patch Set: bug fix 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.willStartLoadingResource(
257 m_identifier, request, Resource::Image, initiator, 257 m_identifier, request, Resource::Image, initiator,
258 FetchContext::V8ActivityLoggingPolicy::Log); 258 FetchContext::V8ActivityLoggingPolicy::Log);
259 259
260 FetchInitiatorInfo initiatorInfo; 260 FetchInitiatorInfo initiatorInfo;
261 initiatorInfo.name = initiator; 261 initiatorInfo.name = initiator;
262 fetchContext.prepareRequest(m_identifier, request);
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
269 m_loader = WTF::wrapUnique(Platform::current()->createURLLoader()); 270 m_loader = WTF::wrapUnique(Platform::current()->createURLLoader());
270 DCHECK(m_loader); 271 DCHECK(m_loader);
271 WrappedResourceRequest wrappedRequest(request); 272 WrappedResourceRequest wrappedRequest(request);
(...skipping 53 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(m_identifier,
337 passedNewRequest.toMutableResourceRequest());
335 fetchContext.dispatchWillSendRequest( 338 fetchContext.dispatchWillSendRequest(
336 m_identifier, passedNewRequest.toMutableResourceRequest(), 339 m_identifier, passedNewRequest.toResourceRequest(),
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()) {
345 const ResourceResponse& resourceResponse = response.toResourceResponse(); 348 const ResourceResponse& resourceResponse = response.toResourceResponse();
346 probe::didReceiveResourceResponse(frame(), m_identifier, 0, 349 probe::didReceiveResourceResponse(frame(), m_identifier, 0,
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 bool PingLoader::sendBeacon(LocalFrame* frame, 560 bool PingLoader::sendBeacon(LocalFrame* frame,
558 int allowance, 561 int allowance,
559 const KURL& beaconURL, 562 const KURL& beaconURL,
560 Blob* data, 563 Blob* data,
561 int& payloadLength) { 564 int& payloadLength) {
562 BeaconBlob beacon(data); 565 BeaconBlob beacon(data);
563 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength); 566 return sendBeaconCommon(frame, allowance, beaconURL, beacon, payloadLength);
564 } 567 }
565 568
566 } // namespace blink 569 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698