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

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

Issue 2838193002: Split the ScopedSubresourceFilterFeatureToggle into two helper classes. (Closed)
Patch Set: Rebase. 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..06b06f1b3a6f2be15c0e3ddf5aa1321fe1380e7e 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,12 @@ scoped_refptr<ConfigurationList> GetActiveConfigurations() {
namespace testing {
-void ClearCachedActiveConfigurations() {
+scoped_refptr<ConfigurationList> GetAndSetActivateConfigurations(
+ scoped_refptr<ConfigurationList> new_configs) {
base::AutoLock lock(g_active_configurations_lock.Get());
- g_active_configurations.Get() = nullptr;
+ auto old_configs = std::move(g_active_configurations.Get());
+ g_active_configurations.Get() = std::move(new_configs);
+ return old_configs;
}
} // namespace testing

Powered by Google App Engine
This is Rietveld 408576698