summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/about_flags.cc2
-rw-r--r--content/browser/loader/async_revalidation_manager_browsertest.cc12
-rw-r--r--content/browser/loader/resource_dispatcher_host_impl.cc11
-rw-r--r--content/public/common/content_features.cc6
-rw-r--r--content/public/common/content_features.h1
-rw-r--r--content/public/common/content_switches.cc5
-rw-r--r--content/public/common/content_switches.h1
7 files changed, 18 insertions, 20 deletions
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 9caafdc..f84d81a 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -989,7 +989,7 @@ const FeatureEntry kFeatureEntries[] = {
{"enable-stale-while-revalidate",
IDS_FLAGS_ENABLE_STALE_WHILE_REVALIDATE_NAME,
IDS_FLAGS_ENABLE_STALE_WHILE_REVALIDATE_DESCRIPTION, kOsAll,
- SINGLE_VALUE_TYPE(switches::kEnableStaleWhileRevalidate)},
+ FEATURE_VALUE_TYPE(features::kStaleWhileRevalidate)},
{"enable-suggestions-with-substring-match",
IDS_FLAGS_SUGGESTIONS_WITH_SUB_STRING_MATCH_NAME,
IDS_FLAGS_SUGGESTIONS_WITH_SUB_STRING_MATCH_DESCRIPTION, kOsAll,
diff --git a/content/browser/loader/async_revalidation_manager_browsertest.cc b/content/browser/loader/async_revalidation_manager_browsertest.cc
index 33826ca..9be15a4 100644
--- a/content/browser/loader/async_revalidation_manager_browsertest.cc
+++ b/content/browser/loader/async_revalidation_manager_browsertest.cc
@@ -7,7 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
@@ -43,6 +43,12 @@ class AsyncRevalidationManagerBrowserTest : public ContentBrowserTest {
~AsyncRevalidationManagerBrowserTest() override {}
void SetUp() override {
+ base::FeatureList::ClearInstanceForTesting();
+ scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(
+ "StaleWhileRevalidate2", std::string());
+ base::FeatureList::SetInstance(std::move(feature_list));
+
ASSERT_TRUE(embedded_test_server()->InitializeAndListen());
ContentBrowserTest::SetUp();
}
@@ -51,10 +57,6 @@ class AsyncRevalidationManagerBrowserTest : public ContentBrowserTest {
embedded_test_server()->StartAcceptingConnections();
}
- void SetUpCommandLine(base::CommandLine* command_line) override {
- command_line->AppendSwitch("enable-stale-while-revalidate");
- }
-
base::RunLoop* run_loop() { return &run_loop_; }
int requests_counted() const { return requests_counted_; }
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index ce9d802..7b160b9 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -17,6 +17,7 @@
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
@@ -87,6 +88,7 @@
#include "content/public/browser/stream_info.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/browser_side_navigation_policy.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/process_type.h"
#include "ipc/ipc_message_macros.h"
@@ -564,11 +566,6 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl()
update_load_states_timer_.reset(new base::RepeatingTimer());
- base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- // This needs to be called to mark the trial as active, even if the result
- // isn't used.
- std::string stale_while_revalidate_trial_group =
- base::FieldTrialList::FindFullName("StaleWhileRevalidate");
// stale-while-revalidate currently doesn't work with browser-side navigation.
// Only enable stale-while-revalidate if browser navigation is not enabled.
//
@@ -576,9 +573,7 @@ ResourceDispatcherHostImpl::ResourceDispatcherHostImpl()
// together. Or disable stale-while-revalidate completely before browser-side
// navigation becomes the default. crbug.com/561610
if (!IsBrowserSideNavigationEnabled() &&
- (base::StartsWith(stale_while_revalidate_trial_group, "Enabled",
- base::CompareCase::SENSITIVE) ||
- command_line->HasSwitch(switches::kEnableStaleWhileRevalidate))) {
+ base::FeatureList::IsEnabled(features::kStaleWhileRevalidate)) {
async_revalidation_manager_.reset(new AsyncRevalidationManager);
}
}
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
index a8e364b..4ee7eff 100644
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -48,6 +48,12 @@ const base::Feature kRenderingPipelineThrottling{
const base::Feature kScrollAnchoring{"ScrollAnchoring",
base::FEATURE_DISABLED_BY_DEFAULT};
+// Enables implementation of the Cache-Control: stale-while-revalidate directive
+// which permits servers to allow the use of stale resources while revalidation
+// proceeds in the background. See http://crbug.com/348877
+const base::Feature kStaleWhileRevalidate{"StaleWhileRevalidate2",
+ base::FEATURE_DISABLED_BY_DEFAULT};
+
// Enables token binding
// (https://www.ietf.org/id/draft-ietf-tokbind-protocol-04.txt).
const base::Feature kTokenBinding{"token-binding",
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
index 6c6a1ca..32ae2f3 100644
--- a/content/public/common/content_features.h
+++ b/content/public/common/content_features.h
@@ -24,6 +24,7 @@ CONTENT_EXPORT extern const base::Feature kNonValidatingReloadOnRefreshContent;
CONTENT_EXPORT extern const base::Feature kOptimizeIPCForSmallResource;
CONTENT_EXPORT extern const base::Feature kRenderingPipelineThrottling;
CONTENT_EXPORT extern const base::Feature kScrollAnchoring;
+CONTENT_EXPORT extern const base::Feature kStaleWhileRevalidate;
CONTENT_EXPORT extern const base::Feature kTokenBinding;
CONTENT_EXPORT extern const base::Feature kUpdateRendererPriorityOnStartup;
CONTENT_EXPORT extern const base::Feature kWebFontsIntervention;
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index 1dac476..e2cf9e5 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -438,11 +438,6 @@ const char kEnableSmoothScrolling[] = "enable-smooth-scrolling";
// Enable spatial navigation
const char kEnableSpatialNavigation[] = "enable-spatial-navigation";
-// Enables implementation of the Cache-Control: stale-while-revalidate directive
-// which permits servers to allow the use of stale resources while revalidation
-// proceeds in the background.
-const char kEnableStaleWhileRevalidate[] = "enable-stale-while-revalidate";
-
// Enables StatsTable, logging statistics to a global named shared memory table.
const char kEnableStatsTable[] = "enable-stats-table";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index 51322c3d5..c64011d 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -131,7 +131,6 @@ extern const char kEnableSkiaBenchmarking[];
CONTENT_EXPORT extern const char kEnableSlimmingPaintV2[];
CONTENT_EXPORT extern const char kEnableSmoothScrolling[];
CONTENT_EXPORT extern const char kEnableSpatialNavigation[];
-CONTENT_EXPORT extern const char kEnableStaleWhileRevalidate[];
CONTENT_EXPORT extern const char kEnableStatsTable[];
CONTENT_EXPORT extern const char kEnableStrictMixedContentChecking[];
CONTENT_EXPORT extern const char kEnableStrictPowerfulFeatureRestrictions[];