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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/fetch/ClientHintsPreferences.h" 6 #include "core/fetch/ClientHintsPreferences.h"
7 7
8 #include "core/fetch/ResourceFetcher.h"
8 #include "platform/RuntimeEnabledFeatures.h" 9 #include "platform/RuntimeEnabledFeatures.h"
9 #include "platform/network/HTTPParsers.h" 10 #include "platform/network/HTTPParsers.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPrefere nces& preferences) 14 void handleAcceptClientHintsHeader(const String& headerValue, ClientHintsPrefere nces& preferences, ResourceFetcher* fetcher)
14 { 15 {
15 if (!RuntimeEnabledFeatures::clientHintsEnabled() || headerValue.isEmpty()) 16 if (!RuntimeEnabledFeatures::clientHintsEnabled() || headerValue.isEmpty())
16 return; 17 return;
17 CommaDelimitedHeaderSet acceptCH; 18 CommaDelimitedHeaderSet acceptCH;
18 parseCommaDelimitedHeader(headerValue, acceptCH); 19 parseCommaDelimitedHeader(headerValue, acceptCH);
19 if (acceptCH.contains("dpr")) 20 if (acceptCH.contains("dpr")) {
21 if (fetcher)
22 fetcher->context().countClientHintsDPR();
20 preferences.setShouldSendDPR(true); 23 preferences.setShouldSendDPR(true);
24 }
21 25
22 if (acceptCH.contains("width")) 26 if (acceptCH.contains("width")) {
27 if (fetcher)
28 fetcher->context().countClientHintsResourceWidth();
23 preferences.setShouldSendResourceWidth(true); 29 preferences.setShouldSendResourceWidth(true);
30 }
24 31
25 if (acceptCH.contains("viewport-width")) 32 if (acceptCH.contains("viewport-width")) {
33 if (fetcher)
34 fetcher->context().countClientHintsViewportWidth();
26 preferences.setShouldSendViewportWidth(true); 35 preferences.setShouldSendViewportWidth(true);
36 }
27 } 37 }
28 38
29 } 39 }
OLDNEW
« 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