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

Unified Diff: chrome/browser/io_thread.cc

Issue 665023002: Post-commit fixes for "stale-while-revalidate..." (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
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index b84a24ba1b0c41e2546763f887f4ef6dba0efed9..7ca1526a30cea7873c475d4c61b79bd30ca5fa2b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -311,6 +311,15 @@ const std::string& GetVariationParam(
return it->second;
}
+// Return true if stale-while-revalidate support should be enabled.
+bool IsStaleWhileRevalidateEnabled(const base::CommandLine& command_line) {
+ if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate))
+ return true;
+ const std::string group_name =
+ base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName);
+ return group_name == "Enabled";
+}
+
} // namespace
class IOThread::LoggingNetworkChangeObserver
@@ -660,11 +669,8 @@ 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;
+ globals_->use_stale_while_revalidate =
+ IsStaleWhileRevalidateEnabled(command_line);
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) {
globals_->testing_fixed_http_port =
GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort);
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698