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

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, 2 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 d42723ed6d9935199ba21a782ac4f1a7f6bb9f84..177352e4ec4b68229e67af72f9493f46203288d3 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -136,6 +136,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));
@@ -425,6 +428,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) {
@@ -656,6 +660,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))
Alexei Svitkine (slow) 2014/10/09 21:33:39 I didn't review this part earlier, but now that I
Adam Rice 2014/10/20 09:31:24 Done in https://crrev.com/665023002/
+ globals_->use_stale_while_revalidate = true;
+ if (base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName) ==
+ "Enabled")
+ globals_->use_stale_while_revalidate = true;
mmenke 2014/10/09 14:29:58 nit: Use braces when the conditional of an if sta
Adam Rice 2014/10/20 09:31:24 Indirectly fixed by change requested by asvitkine.
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
globals_->testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
@@ -985,6 +994,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;
globals.enable_tcp_fast_open_for_ssl.CopyToIfSet(

Powered by Google App Engine
This is Rietveld 408576698