Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp

Issue 2544933003: Split methods for ClientHintsPreferences from FrameFetchContext (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 // should the output be spread back across multiple processes? 947 // should the output be spread back across multiple processes?
946 if (!frame()->tree().parent()->isLocalFrame()) 948 if (!frame()->tree().parent()->isLocalFrame())
947 return nullptr; 949 return nullptr;
948 return toLocalFrame(frame()->tree().parent()) 950 return toLocalFrame(frame()->tree().parent())
949 ->loader() 951 ->loader()
950 .documentLoader() 952 .documentLoader()
951 ->fetcher() 953 ->fetcher()
952 ->archive(); 954 ->archive();
953 } 955 }
954 956
955 void FrameFetchContext::countClientHintsDPR() {
956 UseCounter::count(frame(), UseCounter::ClientHintsDPR);
957 }
958
959 void FrameFetchContext::countClientHintsResourceWidth() {
960 UseCounter::count(frame(), UseCounter::ClientHintsResourceWidth);
961 }
962
963 void FrameFetchContext::countClientHintsViewportWidth() {
964 UseCounter::count(frame(), UseCounter::ClientHintsViewportWidth);
965 }
966
967 ResourceLoadPriority FrameFetchContext::modifyPriorityForExperiments( 957 ResourceLoadPriority FrameFetchContext::modifyPriorityForExperiments(
968 ResourceLoadPriority priority) { 958 ResourceLoadPriority priority) {
969 // If Settings is null, we can't verify any experiments are in force. 959 // If Settings is null, we can't verify any experiments are in force.
970 if (!frame()->settings()) 960 if (!frame()->settings())
971 return priority; 961 return priority;
972 962
973 // If enabled, drop the priority of all resources in a subframe. 963 // If enabled, drop the priority of all resources in a subframe.
974 if (frame()->settings()->lowPriorityIframes() && !frame()->isMainFrame()) 964 if (frame()->settings()->lowPriorityIframes() && !frame()->isMainFrame())
975 return ResourceLoadPriorityVeryLow; 965 return ResourceLoadPriorityVeryLow;
976 966
(...skipping 12 matching lines...) Expand all
989 Resource* resource, 979 Resource* resource,
990 LinkLoader::CanLoadResources resourceLoadingPolicy) { 980 LinkLoader::CanLoadResources resourceLoadingPolicy) {
991 TRACE_EVENT1( 981 TRACE_EVENT1(
992 "devtools.timeline", "ResourceReceiveResponse", "data", 982 "devtools.timeline", "ResourceReceiveResponse", "data",
993 InspectorReceiveResponseEvent::data(identifier, frame(), response)); 983 InspectorReceiveResponseEvent::data(identifier, frame(), response));
994 MixedContentChecker::checkMixedPrivatePublic(frame(), 984 MixedContentChecker::checkMixedPrivatePublic(frame(),
995 response.remoteIPAddress()); 985 response.remoteIPAddress());
996 if (m_documentLoader && 986 if (m_documentLoader &&
997 m_documentLoader == 987 m_documentLoader ==
998 m_documentLoader->frame()->loader().provisionalDocumentLoader()) { 988 m_documentLoader->frame()->loader().provisionalDocumentLoader()) {
999 ResourceFetcher* fetcher = nullptr; 989 FrameClientHintsPreferencesContext hintsContext(frame());
1000 if (frame()->document())
1001 fetcher = frame()->document()->fetcher();
1002 m_documentLoader->clientHintsPreferences() 990 m_documentLoader->clientHintsPreferences()
1003 .updateFromAcceptClientHintsHeader( 991 .updateFromAcceptClientHintsHeader(
1004 response.httpHeaderField(HTTPNames::Accept_CH), fetcher); 992 response.httpHeaderField(HTTPNames::Accept_CH), &hintsContext);
1005 // When response is received with a provisional docloader, the resource 993 // When response is received with a provisional docloader, the resource
1006 // haven't committed yet, and we cannot load resources, only preconnect. 994 // haven't committed yet, and we cannot load resources, only preconnect.
1007 resourceLoadingPolicy = LinkLoader::DoNotLoadResources; 995 resourceLoadingPolicy = LinkLoader::DoNotLoadResources;
1008 } 996 }
1009 LinkLoader::loadLinksFromHeader( 997 LinkLoader::loadLinksFromHeader(
1010 response.httpHeaderField(HTTPNames::Link), response.url(), 998 response.httpHeaderField(HTTPNames::Link), response.url(),
1011 frame()->document(), NetworkHintsInterfaceImpl(), resourceLoadingPolicy, 999 frame()->document(), NetworkHintsInterfaceImpl(), resourceLoadingPolicy,
1012 LinkLoader::LoadAll, nullptr); 1000 LinkLoader::LoadAll, nullptr);
1013 1001
1014 if (response.hasMajorCertificateErrors()) { 1002 if (response.hasMajorCertificateErrors()) {
(...skipping 11 matching lines...) Expand all
1026 response); 1014 response);
1027 } 1015 }
1028 1016
1029 DEFINE_TRACE(FrameFetchContext) { 1017 DEFINE_TRACE(FrameFetchContext) {
1030 visitor->trace(m_document); 1018 visitor->trace(m_document);
1031 visitor->trace(m_documentLoader); 1019 visitor->trace(m_documentLoader);
1032 FetchContext::trace(visitor); 1020 FetchContext::trace(visitor);
1033 } 1021 }
1034 1022
1035 } // namespace blink 1023 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameFetchContext.h ('k') | third_party/WebKit/Source/core/loader/HttpEquiv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698