| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "platform/mhtml/MHTMLArchive.h" | 72 #include "platform/mhtml/MHTMLArchive.h" |
| 73 #include "platform/network/NetworkUtils.h" | 73 #include "platform/network/NetworkUtils.h" |
| 74 #include "platform/network/ResourceLoadPriority.h" | 74 #include "platform/network/ResourceLoadPriority.h" |
| 75 #include "platform/network/ResourceTimingInfo.h" | 75 #include "platform/network/ResourceTimingInfo.h" |
| 76 #include "platform/weborigin/SchemeRegistry.h" | 76 #include "platform/weborigin/SchemeRegistry.h" |
| 77 #include "platform/weborigin/SecurityPolicy.h" | 77 #include "platform/weborigin/SecurityPolicy.h" |
| 78 #include "public/platform/WebCachePolicy.h" | 78 #include "public/platform/WebCachePolicy.h" |
| 79 #include "public/platform/WebDocumentSubresourceFilter.h" | 79 #include "public/platform/WebDocumentSubresourceFilter.h" |
| 80 #include "public/platform/WebInsecureRequestPolicy.h" | 80 #include "public/platform/WebInsecureRequestPolicy.h" |
| 81 #include "public/platform/WebViewScheduler.h" | 81 #include "public/platform/WebViewScheduler.h" |
| 82 #include "wtf/CurrentTime.h" |
| 82 #include "wtf/Vector.h" | 83 #include "wtf/Vector.h" |
| 83 #include <algorithm> | 84 #include <algorithm> |
| 84 #include <memory> | 85 #include <memory> |
| 85 | 86 |
| 86 namespace blink { | 87 namespace blink { |
| 87 | 88 |
| 88 namespace { | 89 namespace { |
| 89 | 90 |
| 90 void emitWarningForDocWriteScripts(const String& url, Document& document) { | 91 void emitWarningForDocWriteScripts(const String& url, Document& document) { |
| 91 String message = "A Parser-blocking, cross-origin script, " + url + | 92 String message = "A Parser-blocking, cross-origin script, " + url + |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 InspectorSendRequestEvent::data(identifier, frame(), request)); | 406 InspectorSendRequestEvent::data(identifier, frame(), request)); |
| 406 // For initial requests, prepareRequest() is called in | 407 // For initial requests, prepareRequest() is called in |
| 407 // willStartLoadingResource(), before revalidation policy is determined. That | 408 // willStartLoadingResource(), before revalidation policy is determined. That |
| 408 // call doesn't exist for redirects, so call preareRequest() here. | 409 // call doesn't exist for redirects, so call preareRequest() here. |
| 409 if (!redirectResponse.isNull()) { | 410 if (!redirectResponse.isNull()) { |
| 410 prepareRequest(request); | 411 prepareRequest(request); |
| 411 } else { | 412 } else { |
| 412 frame()->loader().progress().willStartLoading(identifier, | 413 frame()->loader().progress().willStartLoading(identifier, |
| 413 request.priority()); | 414 request.priority()); |
| 414 } | 415 } |
| 415 InspectorInstrumentation::willSendRequest(frame(), identifier, | 416 InspectorInstrumentation::willSendRequest( |
| 416 masterDocumentLoader(), request, | 417 frame()->document(), identifier, masterDocumentLoader(), request, |
| 417 redirectResponse, initiatorInfo); | 418 redirectResponse, initiatorInfo, monotonicallyIncreasingTime(), |
| 419 currentTime()); |
| 418 if (frame()->frameScheduler()) | 420 if (frame()->frameScheduler()) |
| 419 frame()->frameScheduler()->didStartLoading(identifier); | 421 frame()->frameScheduler()->didStartLoading(identifier); |
| 420 } | 422 } |
| 421 | 423 |
| 422 void FrameFetchContext::dispatchDidReceiveResponse( | 424 void FrameFetchContext::dispatchDidReceiveResponse( |
| 423 unsigned long identifier, | 425 unsigned long identifier, |
| 424 const ResourceResponse& response, | 426 const ResourceResponse& response, |
| 425 WebURLRequest::FrameType frameType, | 427 WebURLRequest::FrameType frameType, |
| 426 WebURLRequest::RequestContext requestContext, | 428 WebURLRequest::RequestContext requestContext, |
| 427 Resource* resource) { | 429 Resource* resource) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 encodedDataLength); | 461 encodedDataLength); |
| 460 } | 462 } |
| 461 | 463 |
| 462 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, | 464 void FrameFetchContext::dispatchDidFinishLoading(unsigned long identifier, |
| 463 double finishTime, | 465 double finishTime, |
| 464 int64_t encodedDataLength) { | 466 int64_t encodedDataLength) { |
| 465 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", | 467 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", |
| 466 InspectorResourceFinishEvent::data(identifier, finishTime, false, | 468 InspectorResourceFinishEvent::data(identifier, finishTime, false, |
| 467 encodedDataLength)); | 469 encodedDataLength)); |
| 468 frame()->loader().progress().completeProgress(identifier); | 470 frame()->loader().progress().completeProgress(identifier); |
| 469 InspectorInstrumentation::didFinishLoading(frame(), identifier, finishTime, | 471 InspectorInstrumentation::didFinishLoading(frame()->document(), identifier, |
| 470 encodedDataLength); | 472 finishTime, encodedDataLength); |
| 471 if (frame()->frameScheduler()) | 473 if (frame()->frameScheduler()) |
| 472 frame()->frameScheduler()->didStopLoading(identifier); | 474 frame()->frameScheduler()->didStopLoading(identifier); |
| 473 } | 475 } |
| 474 | 476 |
| 475 void FrameFetchContext::dispatchDidFail(unsigned long identifier, | 477 void FrameFetchContext::dispatchDidFail(unsigned long identifier, |
| 476 const ResourceError& error, | 478 const ResourceError& error, |
| 477 int64_t encodedDataLength, | 479 int64_t encodedDataLength, |
| 478 bool isInternalRequest) { | 480 bool isInternalRequest) { |
| 479 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", | 481 TRACE_EVENT1("devtools.timeline", "ResourceFinish", "data", |
| 480 InspectorResourceFinishEvent::data(identifier, 0, true, | 482 InspectorResourceFinishEvent::data(identifier, 0, true, |
| 481 encodedDataLength)); | 483 encodedDataLength)); |
| 482 frame()->loader().progress().completeProgress(identifier); | 484 frame()->loader().progress().completeProgress(identifier); |
| 483 InspectorInstrumentation::didFailLoading(frame(), identifier, error); | 485 InspectorInstrumentation::didFailLoading(frame()->document(), identifier, |
| 486 error); |
| 484 // Notification to FrameConsole should come AFTER InspectorInstrumentation | 487 // Notification to FrameConsole should come AFTER InspectorInstrumentation |
| 485 // call, DevTools front-end relies on this. | 488 // call, DevTools front-end relies on this. |
| 486 if (!isInternalRequest) | 489 if (!isInternalRequest) |
| 487 frame()->console().didFailLoading(identifier, error); | 490 frame()->console().didFailLoading(identifier, error); |
| 488 if (frame()->frameScheduler()) | 491 if (frame()->frameScheduler()) |
| 489 frame()->frameScheduler()->didStopLoading(identifier); | 492 frame()->frameScheduler()->didStopLoading(identifier); |
| 490 } | 493 } |
| 491 | 494 |
| 492 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache( | 495 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache( |
| 493 unsigned long identifier, | 496 unsigned long identifier, |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 | 1047 |
| 1045 if (response.hasMajorCertificateErrors()) { | 1048 if (response.hasMajorCertificateErrors()) { |
| 1046 MixedContentChecker::handleCertificateError(frame(), response, frameType, | 1049 MixedContentChecker::handleCertificateError(frame(), response, frameType, |
| 1047 requestContext); | 1050 requestContext); |
| 1048 } | 1051 } |
| 1049 | 1052 |
| 1050 frame()->loader().progress().incrementProgress(identifier, response); | 1053 frame()->loader().progress().incrementProgress(identifier, response); |
| 1051 frameLoaderClient()->dispatchDidReceiveResponse(response); | 1054 frameLoaderClient()->dispatchDidReceiveResponse(response); |
| 1052 DocumentLoader* documentLoader = masterDocumentLoader(); | 1055 DocumentLoader* documentLoader = masterDocumentLoader(); |
| 1053 InspectorInstrumentation::didReceiveResourceResponse( | 1056 InspectorInstrumentation::didReceiveResourceResponse( |
| 1054 frame(), identifier, documentLoader, response, resource); | 1057 frame()->document(), identifier, documentLoader, response, resource); |
| 1055 // It is essential that inspector gets resource response BEFORE console. | 1058 // It is essential that inspector gets resource response BEFORE console. |
| 1056 frame()->console().reportResourceResponseReceived(documentLoader, identifier, | 1059 frame()->console().reportResourceResponseReceived(documentLoader, identifier, |
| 1057 response); | 1060 response); |
| 1058 } | 1061 } |
| 1059 | 1062 |
| 1060 DEFINE_TRACE(FrameFetchContext) { | 1063 DEFINE_TRACE(FrameFetchContext) { |
| 1061 visitor->trace(m_document); | 1064 visitor->trace(m_document); |
| 1062 visitor->trace(m_documentLoader); | 1065 visitor->trace(m_documentLoader); |
| 1063 FetchContext::trace(visitor); | 1066 FetchContext::trace(visitor); |
| 1064 } | 1067 } |
| 1065 | 1068 |
| 1066 } // namespace blink | 1069 } // namespace blink |
| OLD | NEW |