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

Unified Diff: extensions/common/features/feature_provider.cc

Issue 2338273005: [Extensions] Make feature-related singletons leaky (Closed)
Patch Set: Created 4 years, 3 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 | « extensions/common/extension_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/features/feature_provider.cc
diff --git a/extensions/common/features/feature_provider.cc b/extensions/common/features/feature_provider.cc
index 6b179dd2c926f3bb5be222644c2fef479d79bc40..6353edb324c0920ee7e31b138cde66782e7c0f29 100644
--- a/extensions/common/features/feature_provider.cc
+++ b/extensions/common/features/feature_provider.cc
@@ -23,16 +23,6 @@ namespace {
class Static {
public:
- FeatureProvider* GetFeatures(const std::string& name) const {
- auto it = feature_providers_.find(name);
- if (it == feature_providers_.end())
- CRASH_WITH_MINIDUMP("FeatureProvider \"" + name + "\" not found");
- return it->second.get();
- }
-
- private:
- friend struct base::DefaultLazyInstanceTraits<Static>;
-
Static() {
TRACE_EVENT0("startup", "extensions::FeatureProvider::Static");
base::Time begin_time = base::Time::Now();
@@ -59,10 +49,20 @@ class Static {
}
}
+ FeatureProvider* GetFeatures(const std::string& name) const {
+ auto it = feature_providers_.find(name);
+ if (it == feature_providers_.end())
+ CRASH_WITH_MINIDUMP("FeatureProvider \"" + name + "\" not found");
+ return it->second.get();
+ }
+
+ private:
std::map<std::string, std::unique_ptr<FeatureProvider>> feature_providers_;
+
+ DISALLOW_COPY_AND_ASSIGN(Static);
};
-base::LazyInstance<Static> g_static = LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<Static>::Leaky g_static = LAZY_INSTANCE_INITIALIZER;
const Feature* GetFeatureFromProviderByName(const std::string& provider_name,
const std::string& feature_name) {
« no previous file with comments | « extensions/common/extension_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698