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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp

Issue 2860093003: Implement device-ram client hints header (Closed)
Patch Set: Rebase UseCounter.h Created 3 years, 7 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
Index: third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
index 4e0a5ed88605a7a6a6852086ae5a05609ea11376..4c3a634096594363f878e710803b8d5a20e63657 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.cpp
@@ -10,12 +10,14 @@
namespace blink {
ClientHintsPreferences::ClientHintsPreferences()
- : should_send_dpr_(false),
+ : should_send_device_ram_(false),
+ should_send_dpr_(false),
should_send_resource_width_(false),
should_send_viewport_width_(false) {}
void ClientHintsPreferences::UpdateFrom(
const ClientHintsPreferences& preferences) {
+ should_send_device_ram_ = preferences.should_send_device_ram_;
should_send_dpr_ = preferences.should_send_dpr_;
should_send_resource_width_ = preferences.should_send_resource_width_;
should_send_viewport_width_ = preferences.should_send_viewport_width_;
@@ -29,6 +31,13 @@ void ClientHintsPreferences::UpdateFromAcceptClientHintsHeader(
CommaDelimitedHeaderSet accept_client_hints_header;
ParseCommaDelimitedHeader(header_value, accept_client_hints_header);
+ if (RuntimeEnabledFeatures::deviceRAMHeaderEnabled() &&
+ accept_client_hints_header.Contains("device-ram")) {
+ if (context)
+ context->CountClientHintsDeviceRAM();
+ should_send_device_ram_ = true;
+ }
+
if (accept_client_hints_header.Contains("dpr")) {
if (context)
context->CountClientHintsDPR();
« no previous file with comments | « third_party/WebKit/Source/platform/loader/fetch/ClientHintsPreferences.h ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698