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

Unified Diff: Source/core/fetch/ClientHintsPreferences.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fetch/ClientHintsPreferences.h ('k') | Source/core/fetch/ClientHintsPreferencesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ClientHintsPreferences.cpp
diff --git a/Source/core/fetch/ClientHintsPreferences.cpp b/Source/core/fetch/ClientHintsPreferences.cpp
index 1f4c25e0e4f9103d64fc2b3b023b902629513ed6..0a31a59a2607ab9399af9da40bc6ce313b73f79e 100644
--- a/Source/core/fetch/ClientHintsPreferences.cpp
+++ b/Source/core/fetch/ClientHintsPreferences.cpp
@@ -5,25 +5,35 @@
#include "config.h"
#include "core/fetch/ClientHintsPreferences.h"
+#include "core/fetch/ResourceFetcher.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/network/HTTPParsers.h"
namespace blink {
-void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPreferences& preferences)
+void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPreferences& preferences, ResourceFetcher* fetcher)
{
if (!RuntimeEnabledFeatures::clientHintsEnabled() || headerValue.isEmpty())
return;
CommaDelimitedHeaderSet acceptCH;
parseCommaDelimitedHeader(headerValue, acceptCH);
- if (acceptCH.contains("dpr"))
+ if (acceptCH.contains("dpr")) {
+ if (fetcher)
+ fetcher->context().countClientHintsDPR();
preferences.setShouldSendDPR(true);
+ }
- if (acceptCH.contains("width"))
+ if (acceptCH.contains("width")) {
+ if (fetcher)
+ fetcher->context().countClientHintsResourceWidth();
preferences.setShouldSendResourceWidth(true);
+ }
- if (acceptCH.contains("viewport-width"))
+ if (acceptCH.contains("viewport-width")) {
+ if (fetcher)
+ fetcher->context().countClientHintsViewportWidth();
preferences.setShouldSendViewportWidth(true);
+ }
}
}
« no previous file with comments | « Source/core/fetch/ClientHintsPreferences.h ('k') | Source/core/fetch/ClientHintsPreferencesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698