OLD | NEW |
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 { | 316 { |
317 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); | 317 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); |
318 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV
ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier,
loadPriority)); | 318 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV
ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier,
loadPriority)); |
319 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa
dPriority); | 319 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa
dPriority); |
320 } | 320 } |
321 | 321 |
322 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest
& request, const ResourceResponse& redirectResponse) | 322 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest
& request, const ResourceResponse& redirectResponse) |
323 { | 323 { |
324 frame()->loader().applyUserAgent(request); | 324 frame()->loader().applyUserAgent(request); |
325 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); | 325 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); |
| 326 InspectorInstrumentation::prepareRequest(frame(), masterDocumentLoader(), re
quest); |
326 } | 327 } |
327 | 328 |
328 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) | 329 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, const
ResourceRequest& request, const ResourceResponse& redirectResponse, const FetchI
nitiatorInfo& initiatorInfo) |
329 { | 330 { |
330 // For initial requests, prepareRequest() is called in | |
331 // willStartLoadingResource(), before revalidation policy is determined. | |
332 // That call doesn't exist for redirects, so call preareRequest() here. | |
333 if (!redirectResponse.isNull()) | |
334 prepareRequest(identifier, request, redirectResponse); | |
335 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); | 331 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); |
336 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); | 332 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); |
337 if (frame()->frameScheduler()) | 333 if (frame()->frameScheduler()) |
338 frame()->frameScheduler()->didStartLoading(identifier); | 334 frame()->frameScheduler()->didStartLoading(identifier); |
339 } | 335 } |
340 | 336 |
341 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) | 337 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) |
342 { | 338 { |
343 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC
ontext, resource, LinkLoader::LoadResourcesAndPreconnect); | 339 dispatchDidReceiveResponseInternal(identifier, response, frameType, requestC
ontext, resource, LinkLoader::LoadResourcesAndPreconnect); |
344 } | 340 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 value->setString("requestId", requestId); | 410 value->setString("requestId", requestId); |
415 value->setString("url", url.getString()); | 411 value->setString("url", url.getString()); |
416 value->setInteger("priority", priority); | 412 value->setInteger("priority", priority); |
417 return value; | 413 return value; |
418 } | 414 } |
419 | 415 |
420 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou
rceRequest& request, Resource::Type type) | 416 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou
rceRequest& request, Resource::Type type) |
421 { | 417 { |
422 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe
sourceTraceData(identifier, request.url(), request.priority())); | 418 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe
sourceTraceData(identifier, request.url(), request.priority())); |
423 frame()->loader().progress().willStartLoading(identifier); | 419 frame()->loader().progress().willStartLoading(identifier); |
424 prepareRequest(identifier, request, ResourceResponse()); | |
425 | 420 |
426 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request.
url().isValid()) | 421 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request.
url().isValid()) |
427 return; | 422 return; |
428 if (type == Resource::MainResource) | 423 if (type == Resource::MainResource) |
429 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r
equest); | 424 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r
equest); |
430 else | 425 else |
431 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque
st); | 426 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque
st); |
432 } | 427 } |
433 | 428 |
434 void FrameFetchContext::didLoadResource(Resource* resource) | 429 void FrameFetchContext::didLoadResource(Resource* resource) |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 } | 828 } |
834 | 829 |
835 DEFINE_TRACE(FrameFetchContext) | 830 DEFINE_TRACE(FrameFetchContext) |
836 { | 831 { |
837 visitor->trace(m_document); | 832 visitor->trace(m_document); |
838 visitor->trace(m_documentLoader); | 833 visitor->trace(m_documentLoader); |
839 FetchContext::trace(visitor); | 834 FetchContext::trace(visitor); |
840 } | 835 } |
841 | 836 |
842 } // namespace blink | 837 } // namespace blink |
OLD | NEW |