summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index b84a24b..7ca1526 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);