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

Unified Diff: components/subresource_filter/core/browser/subresource_filter_features.cc

Issue 2838193002: Split the ScopedSubresourceFilterFeatureToggle into two helper classes. (Closed)
Patch Set: More polish. Created 3 years, 8 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
Index: components/subresource_filter/core/browser/subresource_filter_features.cc
diff --git a/components/subresource_filter/core/browser/subresource_filter_features.cc b/components/subresource_filter/core/browser/subresource_filter_features.cc
index 943c2e78f29f1c68fa657f1c522f9ff525d910e9..d3aec5fe5543a93206be24c032a7726f26269a9a 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features.cc
+++ b/components/subresource_filter/core/browser/subresource_filter_features.cc
@@ -153,8 +153,14 @@ const char kSuppressNotificationsParameterName[] = "suppress_notifications";
const char kWhitelistSiteOnReloadParameterName[] = "whitelist_site_on_reload";
Configuration::Configuration() = default;
-Configuration::~Configuration() = default;
+Configuration::Configuration(ActivationLevel activation_level,
+ ActivationScope activation_scope,
+ ActivationList activation_list)
+ : activation_level(activation_level),
+ activation_scope(activation_scope),
+ activation_list(activation_list) {}
Configuration::Configuration(Configuration&&) = default;
+Configuration::~Configuration() = default;
Configuration& Configuration::operator=(Configuration&&) = default;
ConfigurationList::ConfigurationList(Configuration config)
@@ -172,9 +178,11 @@ scoped_refptr<ConfigurationList> GetActiveConfigurations() {
namespace testing {
-void ClearCachedActiveConfigurations() {
+scoped_refptr<ConfigurationList> ReplaceCachedActiveConfigurations(
+ scoped_refptr<ConfigurationList> configs) {
base::AutoLock lock(g_active_configurations_lock.Get());
- g_active_configurations.Get() = nullptr;
+ std::swap(g_active_configurations.Get(), configs);
+ return configs;
}
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698