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

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

Issue 1189523015: Add use-counters for Client-Hints features (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changed to counting functions Created 5 years, 6 months 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
« no previous file with comments | « Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq uest& request, const ResourceResponse& response) 216 void FrameFetchContext::dispatchDidLoadResourceFromMemoryCache(const ResourceReq uest& request, const ResourceResponse& response)
217 { 217 {
218 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request, response); 218 frame()->loader().client()->dispatchDidLoadResourceFromMemoryCache(request, response);
219 } 219 }
220 220
221 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, ResourceLoader* resourceLoader) 221 void FrameFetchContext::dispatchDidReceiveResponse(unsigned long identifier, con st ResourceResponse& response, ResourceLoader* resourceLoader)
222 { 222 {
223 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss()); 223 MixedContentChecker::checkMixedPrivatePublic(frame(), response.remoteIPAddre ss());
224 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do cument()); 224 LinkLoader::loadLinkFromHeader(response.httpHeaderField("Link"), frame()->do cument());
225 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) 225 if (m_documentLoader == frame()->loader().provisionalDocumentLoader()) {
226 handleAcceptClientHintsHeader(response.httpHeaderField("accept-ch"), m_d ocumentLoader->clientHintsPreferences()); 226 ResourceFetcher* fetcher = nullptr;
227 if (frame()->document())
228 fetcher = frame()->document()->fetcher();
229 handleAcceptClientHintsHeader(response.httpHeaderField("accept-ch"), m_d ocumentLoader->clientHintsPreferences(), fetcher);
230 }
227 231
228 frame()->loader().progress().incrementProgress(identifier, response); 232 frame()->loader().progress().incrementProgress(identifier, response);
229 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide ntifier, response); 233 frame()->loader().client()->dispatchDidReceiveResponse(m_documentLoader, ide ntifier, response);
230 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame (), response)); 234 TRACE_EVENT_INSTANT1("devtools.timeline", "ResourceReceiveResponse", TRACE_E VENT_SCOPE_THREAD, "data", InspectorReceiveResponseEvent::data(identifier, frame (), response));
231 DocumentLoader* documentLoader = ensureLoaderForNotifications(); 235 DocumentLoader* documentLoader = ensureLoaderForNotifications();
232 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resourceLoader); 236 InspectorInstrumentation::didReceiveResourceResponse(frame(), identifier, do cumentLoader, response, resourceLoader);
233 // It is essential that inspector gets resource response BEFORE console. 237 // It is essential that inspector gets resource response BEFORE console.
234 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response); 238 frame()->console().reportResourceResponseReceived(documentLoader, identifier , response);
235 } 239 }
236 240
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest) 634 void FrameFetchContext::addCSPHeaderIfNecessary(Resource::Type type, FetchReques t& fetchRequest)
631 { 635 {
632 if (!m_document) 636 if (!m_document)
633 return; 637 return;
634 638
635 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy(); 639 const ContentSecurityPolicy* csp = m_document->contentSecurityPolicy();
636 if (csp->shouldSendCSPHeader(type)) 640 if (csp->shouldSendCSPHeader(type))
637 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" ); 641 fetchRequest.mutableResourceRequest().addHTTPHeaderField("CSP", "active" );
638 } 642 }
639 643
644 void FrameFetchContext::countClientHintsDPR()
645 {
646 UseCounter::count(frame(), UseCounter::ClientHintsDPR);
647 }
648
649 void FrameFetchContext::countClientHintsResourceWidth()
650 {
651 UseCounter::count(frame(), UseCounter::ClientHintsResourceWidth);
652 }
653
654 void FrameFetchContext::countClientHintsViewportWidth()
655 {
656 UseCounter::count(frame(), UseCounter::ClientHintsViewportWidth);
657 }
658
640 DEFINE_TRACE(FrameFetchContext) 659 DEFINE_TRACE(FrameFetchContext)
641 { 660 {
642 visitor->trace(m_document); 661 visitor->trace(m_document);
643 FetchContext::trace(visitor); 662 FetchContext::trace(visitor);
644 } 663 }
645 664
646 } // namespace blink 665 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameFetchContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698