| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 #include "platform/TracedValue.h" | 66 #include "platform/TracedValue.h" |
| 67 #include "platform/mhtml/MHTMLArchive.h" | 67 #include "platform/mhtml/MHTMLArchive.h" |
| 68 #include "platform/network/ResourceLoadPriority.h" | 68 #include "platform/network/ResourceLoadPriority.h" |
| 69 #include "platform/network/ResourceTimingInfo.h" | 69 #include "platform/network/ResourceTimingInfo.h" |
| 70 #include "platform/weborigin/SchemeRegistry.h" | 70 #include "platform/weborigin/SchemeRegistry.h" |
| 71 #include "platform/weborigin/SecurityPolicy.h" | 71 #include "platform/weborigin/SecurityPolicy.h" |
| 72 #include "public/platform/WebCachePolicy.h" | 72 #include "public/platform/WebCachePolicy.h" |
| 73 #include "public/platform/WebDocumentSubresourceFilter.h" | 73 #include "public/platform/WebDocumentSubresourceFilter.h" |
| 74 #include "public/platform/WebFrameScheduler.h" | 74 #include "public/platform/WebFrameScheduler.h" |
| 75 #include "public/platform/WebInsecureRequestPolicy.h" | 75 #include "public/platform/WebInsecureRequestPolicy.h" |
| 76 #include "public/platform/WebViewScheduler.h" |
| 76 #include <algorithm> | 77 #include <algorithm> |
| 77 #include <memory> | 78 #include <memory> |
| 78 | 79 |
| 79 namespace blink { | 80 namespace blink { |
| 80 | 81 |
| 81 namespace { | 82 namespace { |
| 82 | 83 |
| 83 void emitWarningForDocWriteScripts(const String& url, Document& document) | 84 void emitWarningForDocWriteScripts(const String& url, Document& document) |
| 84 { | 85 { |
| 85 String message = "A Parser-blocking, cross-origin script, " + url + ", is in
voked via document.write. This may be blocked by the browser if the device has p
oor network connectivity."; | 86 String message = "A Parser-blocking, cross-origin script, " + url + ", is in
voked via document.write. This may be blocked by the browser if the device has p
oor network connectivity."; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 | 313 |
| 313 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) | 314 void FrameFetchContext::dispatchWillSendRequest(unsigned long identifier, Resour
ceRequest& request, const ResourceResponse& redirectResponse, const FetchInitiat
orInfo& initiatorInfo) |
| 314 { | 315 { |
| 315 // For initial requests, prepareRequest() is called in | 316 // For initial requests, prepareRequest() is called in |
| 316 // willStartLoadingResource(), before revalidation policy is determined. | 317 // willStartLoadingResource(), before revalidation policy is determined. |
| 317 // That call doesn't exist for redirects, so call preareRequest() here. | 318 // That call doesn't exist for redirects, so call preareRequest() here. |
| 318 if (!redirectResponse.isNull()) | 319 if (!redirectResponse.isNull()) |
| 319 prepareRequest(identifier, request, redirectResponse); | 320 prepareRequest(identifier, request, redirectResponse); |
| 320 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); | 321 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceSendRequest", TRACE_EVENT
_SCOPE_THREAD, "data", InspectorSendRequestEvent::data(identifier, frame(), requ
est)); |
| 321 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); | 322 InspectorInstrumentation::willSendRequest(frame(), identifier, masterDocumen
tLoader(), request, redirectResponse, initiatorInfo); |
| 323 if (frame()->frameScheduler()) |
| 324 frame()->frameScheduler()->incrementPendingResourceLoadCount(); |
| 322 } | 325 } |
| 323 | 326 |
| 324 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) | 327 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con
st ResourceResponse& response, WebURLRequest::FrameType frameType, WebURLRequest
::RequestContext requestContext, Resource* resource) |
| 325 { | 328 { |
| 326 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; | 329 LinkLoader::CanLoadResources resourceLoadingPolicy = LinkLoader::LoadResourc
esAndPreconnect; |
| 327 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); | 330 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre
ss()); |
| 328 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { | 331 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) { |
| 329 ResourceFetcher* fetcher = nullptr; | 332 ResourceFetcher* fetcher = nullptr; |
| 330 if (frame()->document()) | 333 if (frame()->document()) |
| 331 fetcher = frame()->document()->fetcher(); | 334 fetcher = frame()->document()->fetcher(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 361 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength,
encodedDataLength); | 364 InspectorInstrumentation::didReceiveData(frame(), identifier, 0, dataLength,
encodedDataLength); |
| 362 } | 365 } |
| 363 | 366 |
| 364 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl
e finishTime, int64_t encodedDataLength) | 367 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, doubl
e finishTime, int64_t encodedDataLength) |
| 365 { | 368 { |
| 366 frame()->loader().progress().completeProgress(identifier); | 369 frame()->loader().progress().completeProgress(identifier); |
| 367 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); | 370 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); |
| 368 | 371 |
| 369 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal
se)); | 372 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, finishTime, fal
se)); |
| 370 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime,
encodedDataLength); | 373 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime,
encodedDataLength); |
| 374 if (frame()->frameScheduler()) |
| 375 frame()->frameScheduler()->decrementPendingResourceLoadCount(); |
| 371 } | 376 } |
| 372 | 377 |
| 373 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource
Error& error, bool isInternalRequest) | 378 void FrameFetchContext::dispatchDidFail(unsigned long identifier, const Resource
Error& error, bool isInternalRequest) |
| 374 { | 379 { |
| 375 frame()->loader().progress().completeProgress(identifier); | 380 frame()->loader().progress().completeProgress(identifier); |
| 376 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); | 381 frame()->loader().client()->dispatchDidFinishLoading(m_documentLoader, ident
ifier); |
| 377 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); | 382 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceFinish", TRACE_EVENT_SCOP
E_THREAD, "data", InspectorResourceFinishEvent::data(identifier, 0, true)); |
| 378 InspectorInstrumentation::didFailLoading(frame(), identifier, error); | 383 InspectorInstrumentation::didFailLoading(frame(), identifier, error); |
| 379 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. | 384 // Notification to FrameConsole should come AFTER InspectorInstrumentation c
all, DevTools front-end relies on this. |
| 380 if (!isInternalRequest) | 385 if (!isInternalRequest) |
| 381 frame()->console().didFailLoading(identifier, error); | 386 frame()->console().didFailLoading(identifier, error); |
| 387 if (frame()->frameScheduler()) |
| 388 frame()->frameScheduler()->decrementPendingResourceLoadCount(); |
| 382 } | 389 } |
| 383 | 390 |
| 384 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide
ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest::
RequestContext requestContext) | 391 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(unsigned long ide
ntifier, Resource* resource, WebURLRequest::FrameType frameType, WebURLRequest::
RequestContext requestContext) |
| 385 { | 392 { |
| 386 ResourceRequest request(resource->url()); | 393 ResourceRequest request(resource->url()); |
| 387 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); | 394 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request,
resource->response()); |
| 388 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); | 395 dispatchWillSendRequest(identifier, request, ResourceResponse(), resource->o
ptions().initiatorInfo); |
| 389 | 396 |
| 390 InspectorInstrumentation::markResourceAsCached(frame(), identifier); | 397 InspectorInstrumentation::markResourceAsCached(frame(), identifier); |
| 391 if (!resource->response().isNull()) | 398 if (!resource->response().isNull()) |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 } | 790 } |
| 784 | 791 |
| 785 DEFINE_TRACE(FrameFetchContext) | 792 DEFINE_TRACE(FrameFetchContext) |
| 786 { | 793 { |
| 787 visitor->trace(m_document); | 794 visitor->trace(m_document); |
| 788 visitor->trace(m_documentLoader); | 795 visitor->trace(m_documentLoader); |
| 789 FetchContext::trace(visitor); | 796 FetchContext::trace(visitor); |
| 790 } | 797 } |
| 791 | 798 |
| 792 } // namespace blink | 799 } // namespace blink |
| OLD | NEW |