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