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

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: Rename stucture members. 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') | net/http/http_response_headers.cc » ('J')
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 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);
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | net/http/http_response_headers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698