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

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

Issue 2203613003: Split header modification out of willSendRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed some accidental file adds Created 4 years, 4 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 { 295 {
296 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo adPriority, intraPriorityValue); 296 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo adPriority, intraPriorityValue);
297 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier, loadPriority)); 297 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier, loadPriority));
298 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa dPriority); 298 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa dPriority);
299 } 299 }
300 300
301 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest & request, const ResourceResponse& redirectResponse) 301 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest & request, const ResourceResponse& redirectResponse)
302 { 302 {
303 frame()->loader().applyUserAgent(request); 303 frame()->loader().applyUserAgent(request);
304 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi fier, request, redirectResponse); 304 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi fier, request, redirectResponse);
305 InspectorInstrumentation::prepareRequest(frame(), masterDocumentLoader(), re quest);
305 } 306 }
306 307
307 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat orInfo& initiatorInfo) 308 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, const ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchI nitiatorInfo& initiatorInfo)
308 { 309 {
309 // For initial requests, prepareRequest() is called in
310 // willStartLoadingResource(), before revalidation policy is determined.
311 // That call doesn't exist for redirects, so call preareRequest() here.
312 if (!redirectResponse.isNull())
313 prepareRequest(identifier, request, redirectResponse);
314 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est)); 310 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT _SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ est));
315 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo); 311 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen tLoader(), request, redirectResponse, initiatorInfo);
316 if (frame()->frameScheduler()) 312 if (frame()->frameScheduler())
317 frame()->frameScheduler()->didStartLoading(identifier); 313 frame()->frameScheduler()->didStartLoading(identifier);
318 } 314 }
319 315
320 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource) 316 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest ::RequestContext requestContext, Resource* resource)
321 { 317 {
322 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC ontext, resource, LinkLoader::LoadResourcesAndPreconnect); 318 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC ontext, resource, LinkLoader::LoadResourcesAndPreconnect);
323 } 319 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 value->setString("requestId", requestId); 389 value->setString("requestId", requestId);
394 value->setString("url", url.getString()); 390 value->setString("url", url.getString());
395 value->setInteger("priority", priority); 391 value->setInteger("priority", priority);
396 return value; 392 return value;
397 } 393 }
398 394
399 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou rceRequest& request, Resource::Type type) 395 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou rceRequest& request, Resource::Type type)
400 { 396 {
401 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe sourceTraceData(identifier, request.url(), request.priority())); 397 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe sourceTraceData(identifier, request.url(), request.priority()));
402 frame()->loader().progress().willStartLoading(identifier); 398 frame()->loader().progress().willStartLoading(identifier);
403 prepareRequest(identifier, request, ResourceResponse());
404 399
405 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request. url().isValid()) 400 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request. url().isValid())
406 return; 401 return;
407 if (type == Resource::MainResource) 402 if (type == Resource::MainResource)
408 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r equest); 403 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r equest);
409 else 404 else
410 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque st); 405 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque st);
411 } 406 }
412 407
413 void FrameFetchContext::didLoadResource(Resource* resource) 408 void FrameFetchContext::didLoadResource(Resource* resource)
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 807 }
813 808
814 DEFINE_TRACE(FrameFetchContext) 809 DEFINE_TRACE(FrameFetchContext)
815 { 810 {
816 visitor->trace(m_document); 811 visitor->trace(m_document);
817 visitor->trace(m_documentLoader); 812 visitor->trace(m_documentLoader);
818 FetchContext::trace(visitor); 813 FetchContext::trace(visitor);
819 } 814 }
820 815
821 } // namespace blink 816 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698