| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/fetch/ClientHintsPreferences.h" | 35 #include "core/fetch/ClientHintsPreferences.h" |
| 36 #include "core/fetch/ResourceLoadingLog.h" | 36 #include "core/fetch/ResourceLoadingLog.h" |
| 37 #include "core/fetch/UniqueIdentifier.h" | 37 #include "core/fetch/UniqueIdentifier.h" |
| 38 #include "core/frame/FrameConsole.h" | 38 #include "core/frame/FrameConsole.h" |
| 39 #include "core/frame/FrameHost.h" | 39 #include "core/frame/FrameHost.h" |
| 40 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
| 41 #include "core/frame/LocalDOMWindow.h" | 41 #include "core/frame/LocalDOMWindow.h" |
| 42 #include "core/frame/LocalFrame.h" | 42 #include "core/frame/LocalFrame.h" |
| 43 #include "core/frame/Settings.h" | 43 #include "core/frame/Settings.h" |
| 44 #include "core/frame/UseCounter.h" |
| 44 #include "core/html/HTMLFrameOwnerElement.h" | 45 #include "core/html/HTMLFrameOwnerElement.h" |
| 45 #include "core/html/imports/HTMLImportsController.h" | 46 #include "core/html/imports/HTMLImportsController.h" |
| 46 #include "core/inspector/ConsoleMessage.h" | 47 #include "core/inspector/ConsoleMessage.h" |
| 47 #include "core/inspector/IdentifiersFactory.h" | 48 #include "core/inspector/IdentifiersFactory.h" |
| 48 #include "core/inspector/InspectorInstrumentation.h" | 49 #include "core/inspector/InspectorInstrumentation.h" |
| 49 #include "core/inspector/InspectorNetworkAgent.h" | 50 #include "core/inspector/InspectorNetworkAgent.h" |
| 50 #include "core/inspector/InspectorTraceEvents.h" | 51 #include "core/inspector/InspectorTraceEvents.h" |
| 51 #include "core/loader/DocumentLoader.h" | 52 #include "core/loader/DocumentLoader.h" |
| 53 #include "core/loader/FrameClientHintsPreferencesContext.h" |
| 52 #include "core/loader/FrameLoader.h" | 54 #include "core/loader/FrameLoader.h" |
| 53 #include "core/loader/FrameLoaderClient.h" | 55 #include "core/loader/FrameLoaderClient.h" |
| 54 #include "core/loader/MixedContentChecker.h" | 56 #include "core/loader/MixedContentChecker.h" |
| 55 #include "core/loader/NetworkHintsInterface.h" | 57 #include "core/loader/NetworkHintsInterface.h" |
| 56 #include "core/loader/PingLoader.h" | 58 #include "core/loader/PingLoader.h" |
| 57 #include "core/loader/ProgressTracker.h" | 59 #include "core/loader/ProgressTracker.h" |
| 58 #include "core/loader/appcache/ApplicationCacheHost.h" | 60 #include "core/loader/appcache/ApplicationCacheHost.h" |
| 59 #include "core/page/NetworkStateNotifier.h" | 61 #include "core/page/NetworkStateNotifier.h" |
| 60 #include "core/page/Page.h" | 62 #include "core/page/Page.h" |
| 61 #include "core/paint/FirstMeaningfulPaintDetector.h" | 63 #include "core/paint/FirstMeaningfulPaintDetector.h" |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 // should the output be spread back across multiple processes? | 928 // should the output be spread back across multiple processes? |
| 927 if (!frame()->tree().parent()->isLocalFrame()) | 929 if (!frame()->tree().parent()->isLocalFrame()) |
| 928 return nullptr; | 930 return nullptr; |
| 929 return toLocalFrame(frame()->tree().parent()) | 931 return toLocalFrame(frame()->tree().parent()) |
| 930 ->loader() | 932 ->loader() |
| 931 .documentLoader() | 933 .documentLoader() |
| 932 ->fetcher() | 934 ->fetcher() |
| 933 ->archive(); | 935 ->archive(); |
| 934 } | 936 } |
| 935 | 937 |
| 936 void FrameFetchContext::countClientHintsDPR() { | |
| 937 UseCounter::count(frame(), UseCounter::ClientHintsDPR); | |
| 938 } | |
| 939 | |
| 940 void FrameFetchContext::countClientHintsResourceWidth() { | |
| 941 UseCounter::count(frame(), UseCounter::ClientHintsResourceWidth); | |
| 942 } | |
| 943 | |
| 944 void FrameFetchContext::countClientHintsViewportWidth() { | |
| 945 UseCounter::count(frame(), UseCounter::ClientHintsViewportWidth); | |
| 946 } | |
| 947 | |
| 948 ResourceLoadPriority FrameFetchContext::modifyPriorityForExperiments( | 938 ResourceLoadPriority FrameFetchContext::modifyPriorityForExperiments( |
| 949 ResourceLoadPriority priority) { | 939 ResourceLoadPriority priority) { |
| 950 // If Settings is null, we can't verify any experiments are in force. | 940 // If Settings is null, we can't verify any experiments are in force. |
| 951 if (!frame()->settings()) | 941 if (!frame()->settings()) |
| 952 return priority; | 942 return priority; |
| 953 | 943 |
| 954 // If enabled, drop the priority of all resources in a subframe. | 944 // If enabled, drop the priority of all resources in a subframe. |
| 955 if (frame()->settings()->lowPriorityIframes() && !frame()->isMainFrame()) | 945 if (frame()->settings()->lowPriorityIframes() && !frame()->isMainFrame()) |
| 956 return ResourceLoadPriorityVeryLow; | 946 return ResourceLoadPriorityVeryLow; |
| 957 | 947 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 969 WebURLRequest::RequestContext requestContext, | 959 WebURLRequest::RequestContext requestContext, |
| 970 Resource* resource, | 960 Resource* resource, |
| 971 LinkLoader::CanLoadResources resourceLoadingPolicy) { | 961 LinkLoader::CanLoadResources resourceLoadingPolicy) { |
| 972 TRACE_EVENT1( | 962 TRACE_EVENT1( |
| 973 "devtools.timeline", "ResourceReceiveResponse", "data", | 963 "devtools.timeline", "ResourceReceiveResponse", "data", |
| 974 InspectorReceiveResponseEvent::data(identifier, frame(), response)); | 964 InspectorReceiveResponseEvent::data(identifier, frame(), response)); |
| 975 MixedContentChecker::checkMixedPrivatePublic(frame(), | 965 MixedContentChecker::checkMixedPrivatePublic(frame(), |
| 976 response.remoteIPAddress()); | 966 response.remoteIPAddress()); |
| 977 if (m_documentLoader && | 967 if (m_documentLoader && |
| 978 m_documentLoader == frame()->loader().provisionalDocumentLoader()) { | 968 m_documentLoader == frame()->loader().provisionalDocumentLoader()) { |
| 979 ResourceFetcher* fetcher = nullptr; | 969 FrameClientHintsPreferencesContext hintsContext(frame()); |
| 980 if (frame()->document()) | |
| 981 fetcher = frame()->document()->fetcher(); | |
| 982 m_documentLoader->clientHintsPreferences() | 970 m_documentLoader->clientHintsPreferences() |
| 983 .updateFromAcceptClientHintsHeader( | 971 .updateFromAcceptClientHintsHeader( |
| 984 response.httpHeaderField(HTTPNames::Accept_CH), fetcher); | 972 response.httpHeaderField(HTTPNames::Accept_CH), &hintsContext); |
| 985 // When response is received with a provisional docloader, the resource | 973 // When response is received with a provisional docloader, the resource |
| 986 // haven't committed yet, and we cannot load resources, only preconnect. | 974 // haven't committed yet, and we cannot load resources, only preconnect. |
| 987 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; | 975 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; |
| 988 } | 976 } |
| 989 LinkLoader::loadLinksFromHeader( | 977 LinkLoader::loadLinksFromHeader( |
| 990 response.httpHeaderField(HTTPNames::Link), response.url(), | 978 response.httpHeaderField(HTTPNames::Link), response.url(), |
| 991 frame()->document(), NetworkHintsInterfaceImpl(), resourceLoadingPolicy, | 979 frame()->document(), NetworkHintsInterfaceImpl(), resourceLoadingPolicy, |
| 992 LinkLoader::LoadAll, nullptr); | 980 LinkLoader::LoadAll, nullptr); |
| 993 | 981 |
| 994 if (response.hasMajorCertificateErrors()) { | 982 if (response.hasMajorCertificateErrors()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1006 response); | 994 response); |
| 1007 } | 995 } |
| 1008 | 996 |
| 1009 DEFINE_TRACE(FrameFetchContext) { | 997 DEFINE_TRACE(FrameFetchContext) { |
| 1010 visitor->trace(m_document); | 998 visitor->trace(m_document); |
| 1011 visitor->trace(m_documentLoader); | 999 visitor->trace(m_documentLoader); |
| 1012 FetchContext::trace(visitor); | 1000 FetchContext::trace(visitor); |
| 1013 } | 1001 } |
| 1014 | 1002 |
| 1015 } // namespace blink | 1003 } // namespace blink |
| OLD | NEW |