Index: chrome/browser/io_thread.cc |
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
index f6ae5163946e5d0e8b5eca5d5224624de62b0fd0..1e84056173059b35eec3d520a2e500327f14bad0 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 CommandLine& command_line) { |
+ const std::string group_name = |
+ base::FieldTrialList::FindFullName(kStaleWhileRevalidateFieldTrialName); |
+ if (command_line.HasSwitch(switches::kEnableStaleWhileRevalidate)) |
+ return true; |
+ 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); |