| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen
tLoader(); | 288 return m_documentLoader ? m_documentLoader.get() : frame()->loader().documen
tLoader(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) | 291 void FrameFetchContext::dispatchDidChangeResourcePriority(unsigned long identifi
er, ResourceLoadPriority loadPriority, int intraPriorityValue) |
| 292 { | 292 { |
| 293 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); | 293 frame()->loader().client()->dispatchDidChangeResourcePriority(identifier, lo
adPriority, intraPriorityValue); |
| 294 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV
ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier,
loadPriority)); | 294 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceChangePriority", TRACE_EV
ENT_SCOPE_THREAD, "data", InspectorChangeResourcePriorityEvent::data(identifier,
loadPriority)); |
| 295 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa
dPriority); | 295 InspectorInstrumentation::didChangeResourcePriority(frame(), identifier, loa
dPriority); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void FrameFetchContext::prepareRequest(unsigned long identifier, ResourceRequest
& request, const ResourceResponse& redirectResponse) |
| 299 { |
| 300 frame()->loader().applyUserAgent(request); |
| 301 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); |
| 302 } |
| 303 |
| 298 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) | 304 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) |
| 299 { | 305 { |
| 300 frame()->loader().applyUserAgent(request); | 306 // For initial requests, prepareRequest() is called in |
| 301 frame()->loader().client()->dispatchWillSendRequest(m_documentLoader, identi
fier, request, redirectResponse); | 307 // willStartLoadingResource(), before revalidation policy is determined. |
| 308 // That call doesn't exist for redirects, so call preareRequest() here. |
| 309 if (!redirectResponse.isNull()) |
| 310 prepareRequest(identifier, request, redirectResponse); |
| 302 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); | 311 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); |
| 303 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); | 312 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); |
| 304 } | 313 } |
| 305 | 314 |
| 306 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) | 315 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) |
| 307 { | 316 { |
| 308 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; | 317 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; |
| 309 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 318 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
| 310 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { | 319 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { |
| 311 ResourceFetcher* fetcher = nullptr; | 320 ResourceFetcher* fetcher = nullptr; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 { | 365 { |
| 357 frame()->loader().progress().completeProgress(identifier); | 366 frame()->loader().progress().completeProgress(identifier); |
| 358 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); | 367 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); |
| 359 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); | 368 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); |
| 360 InspectorInstrumentation::didFailLoading(frame(), identifier, error); | 369 InspectorInstrumentation::didFailLoading(frame(), identifier, error); |
| 361 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. | 370 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. |
| 362 if (!isInternalRequest) | 371 if (!isInternalRequest) |
| 363 frame()->console().didFailLoading(identifier, error); | 372 frame()->console().didFailLoading(identifier, error); |
| 364 } | 373 } |
| 365 | 374 |
| 366 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(Resource* resourc
e, WebURLRequest::FrameType frameType, WebURLRequest::RequestContext requestCont
ext) | 375 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide
ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest::
RequestContext requestContext) |
| 367 { | 376 { |
| 368 ResourceRequest request(resource->url()); | 377 ResourceRequest request(resource->url()); |
| 369 unsigned long identifier = createUniqueIdentifier(); | |
| 370 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); | 378 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); |
| 371 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); | 379 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); |
| 372 | 380 |
| 373 InspectorInstrumentation::markResourceAsCached(frame(), identifier); | 381 InspectorInstrumentation::markResourceAsCached(frame(), identifier); |
| 374 if (!resource->response().isNull()) | 382 if (!resource->response().isNull()) |
| 375 dispatchDidReceiveResponse(identifier, resource->response(), frameType,
requestContext, resource); | 383 dispatchDidReceiveResponse(identifier, resource->response(), frameType,
requestContext, resource); |
| 376 | 384 |
| 377 if (resource->encodedSize() > 0) | 385 if (resource->encodedSize() > 0) |
| 378 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); | 386 dispatchDidReceiveData(identifier, 0, resource->encodedSize(), 0); |
| 379 | 387 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 393 { | 401 { |
| 394 String requestId = IdentifiersFactory::requestId(identifier); | 402 String requestId = IdentifiersFactory::requestId(identifier); |
| 395 | 403 |
| 396 OwnPtr<TracedValue> value = TracedValue::create(); | 404 OwnPtr<TracedValue> value = TracedValue::create(); |
| 397 value->setString("requestId", requestId); | 405 value->setString("requestId", requestId); |
| 398 value->setString("url", url.getString()); | 406 value->setString("url", url.getString()); |
| 399 value->setInteger("priority", priority); | 407 value->setInteger("priority", priority); |
| 400 return value; | 408 return value; |
| 401 } | 409 } |
| 402 | 410 |
| 403 void FrameFetchContext::willStartLoadingResource(Resource* resource, ResourceReq
uest& request) | 411 void FrameFetchContext::willStartLoadingResource(unsigned long identifier, Resou
rceRequest& request, Resource::Type type) |
| 404 { | 412 { |
| 405 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", resource, "data", loadReso
urceTraceData(resource->identifier(), resource->url(), resource->resourceRequest
().priority())); | 413 TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadRe
sourceTraceData(identifier, request.url(), request.priority())); |
| 414 prepareRequest(identifier, request, ResourceResponse()); |
| 406 | 415 |
| 407 if (!m_documentLoader) | 416 if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request.
url().isValid()) |
| 408 return; | 417 return; |
| 409 if (resource->getType() == Resource::MainResource) | 418 if (type == Resource::MainResource) |
| 410 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r
equest); | 419 m_documentLoader->applicationCacheHost()->willStartLoadingMainResource(r
equest); |
| 411 else | 420 else |
| 412 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque
st); | 421 m_documentLoader->applicationCacheHost()->willStartLoadingResource(reque
st); |
| 413 } | 422 } |
| 414 | 423 |
| 415 void FrameFetchContext::didLoadResource(Resource* resource) | 424 void FrameFetchContext::didLoadResource(Resource* resource) |
| 416 { | 425 { |
| 417 if (resource->isLoadEventBlockingResourceType()) | 426 if (resource->isLoadEventBlockingResourceType()) |
| 418 frame()->loader().checkCompleted(); | 427 frame()->loader().checkCompleted(); |
| 419 } | 428 } |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 } | 794 } |
| 786 | 795 |
| 787 DEFINE_TRACE(FrameFetchContext) | 796 DEFINE_TRACE(FrameFetchContext) |
| 788 { | 797 { |
| 789 visitor->trace(m_document); | 798 visitor->trace(m_document); |
| 790 visitor->trace(m_documentLoader); | 799 visitor->trace(m_documentLoader); |
| 791 FetchContext::trace(visitor); | 800 FetchContext::trace(visitor); |
| 792 } | 801 } |
| 793 | 802 |
| 794 } // namespace blink | 803 } // namespace blink |
| OLD | NEW |