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

Unified Diff: chrome/browser/io_thread.cc

Issue 455623003: stale-while-revalidate experimental implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove --disable-stale-while-revalidate flag and strengthen must-revalidate. Created 6 years, 3 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: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 7726fcf5524bddfd32c81c0fd5b953f5d32749a3..6f55596e9fdf05358d7f2d4e3c5e7407f5ec1c56 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -139,6 +139,9 @@ const char kSpdyFieldTrialHoldbackControlGroupName[] = "Control";
const char kSpdyFieldTrialSpdy4GroupName[] = "Spdy4Enabled";
const char kSpdyFieldTrialSpdy4ControlGroupName[] = "Spdy4Control";
+// Field trial for Cache-Control: stale-while-revalidate directive.
+const char kStaleWhileRevalidateFieldTrialName[] = "StaleWhileRevalidate";
+
#if defined(OS_MACOSX) && !defined(OS_IOS)
void ObserveKeychainEvents() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -428,6 +431,7 @@ IOThread::Globals::Globals()
: system_request_context_leak_checker(this),
enable_ssl_connect_job_waiting(false),
ignore_certificate_errors(false),
+ use_stale_while_revalidate(false),
testing_fixed_http_port(0),
testing_fixed_https_port(0),
enable_user_alternate_protocol_ports(false) {
@@ -701,6 +705,11 @@ void IOThread::InitAsync() {
globals_->enable_ssl_connect_job_waiting = true;
if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
globals_->ignore_certificate_errors = true;
+ if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate))
+ globals_->use_stale_while_revalidate = true;
+ if (base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName) ==
+ "Enabled")
+ globals_->use_stale_while_revalidate = true;
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
globals_->testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
@@ -1018,6 +1027,7 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals(
params->enable_ssl_connect_job_waiting =
globals.enable_ssl_connect_job_waiting;
params->ignore_certificate_errors = globals.ignore_certificate_errors;
+ params->use_stale_while_revalidate = globals.use_stale_while_revalidate;
params->testing_fixed_http_port = globals.testing_fixed_http_port;
params->testing_fixed_https_port = globals.testing_fixed_https_port;

Powered by Google App Engine
This is Rietveld 408576698