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

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: Rebase. Created 6 years, 4 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..692cf7f2ffd02a5783e395417ce0ef285ecd6973 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,13 @@ 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 (command_line.HasSwitch(switches::kDisableStaleWhileRevalidate))
+ globals_->use_stale_while_revalidate = false;
+ if (base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName) ==
yhirano 2014/08/26 07:52:01 Can you tell me when and where the field trial is
Adam Rice 2014/08/26 13:38:41 I haven't registered it yet, so "when" is still in
+ "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 +1029,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