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

Unified Diff: chrome/common/extensions/manifest.cc

Issue 9027007: Try to fix the memory leak reports in g_restrictions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: different approach Created 8 years, 11 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 | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/manifest.cc
diff --git a/chrome/common/extensions/manifest.cc b/chrome/common/extensions/manifest.cc
index 78976ebed7bf3188e3f43b95d0629bbc3f28b73b..428f86fcd776de6edc68ef3b3938d80f084a81da 100644
--- a/chrome/common/extensions/manifest.cc
+++ b/chrome/common/extensions/manifest.cc
@@ -97,9 +97,12 @@ struct Restrictions {
}
RestrictionMap map;
+
+ DISALLOW_COPY_AND_ASSIGN(Restrictions);
};
-base::LazyInstance<Restrictions> g_restrictions;
+static base::LazyInstance<Restrictions> g_restrictions =
+ LAZY_INSTANCE_INITIALIZER;
} // namespace
@@ -116,7 +119,7 @@ Manifest::Manifest(DictionaryValue* value) : value_(value) {}
Manifest::~Manifest() {}
bool Manifest::ValidateManifest(string16* error) const {
- Restrictions restrictions = g_restrictions.Get();
+ const Restrictions& restrictions = g_restrictions.Get();
Type type = GetType();
for (DictionaryValue::key_iterator key = value_->begin_keys();
@@ -140,7 +143,7 @@ bool Manifest::ValidateManifest(string16* error) const {
}
bool Manifest::HasKey(const std::string& key) const {
- Restrictions restrictions = g_restrictions.Get();
+ const Restrictions& restrictions = g_restrictions.Get();
return restrictions.CanAccessKey(key, GetType()) && value_->HasKey(key);
}
@@ -225,7 +228,7 @@ bool Manifest::CanAccessPath(const std::string& path) const {
std::vector<std::string> components;
base::SplitString(path, '.', &components);
- Restrictions restrictions = g_restrictions.Get();
+ const Restrictions& restrictions = g_restrictions.Get();
return restrictions.CanAccessKey(components[0], GetType());
}
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698