Commit 753e3c3c authored by Jens Widell's avatar Jens Widell Committed by Commit Bot

Rename conflicting `Static` classes/structs

They conflict in jumbo/unity builds.

Also rename the overly generic `g_static`/`g_lazy_instance` variables.
They did not conflict with anything currently, but generic names in the
anonymous namespace are likely to become a problem eventually, sadly.

Change-Id: Ie90ca3c7eee3d357c3aca205a5551034b768eb77
Reviewed-on: https://chromium-review.googlesource.com/897488Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Jens Widell <jl@opera.com>
Cr-Commit-Position: refs/heads/master@{#533993}
parent 88390020
......@@ -87,16 +87,15 @@ const base::DictionaryValue* GetSchemaChild(
return NULL;
}
struct Static {
Static()
: api(ExtensionAPI::CreateWithDefaultConfiguration()) {
}
struct ExtensionAPIStatic {
ExtensionAPIStatic() : api(ExtensionAPI::CreateWithDefaultConfiguration()) {}
std::unique_ptr<ExtensionAPI> api;
};
base::LazyInstance<Static>::Leaky g_lazy_instance = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<ExtensionAPIStatic>::Leaky g_extension_api_static =
LAZY_INSTANCE_INITIALIZER;
// May override |g_lazy_instance| for a test.
// May override |g_extension_api_static| for a test.
ExtensionAPI* g_shared_instance_for_test = NULL;
} // namespace
......@@ -104,7 +103,7 @@ ExtensionAPI* g_shared_instance_for_test = NULL;
// static
ExtensionAPI* ExtensionAPI::GetSharedInstance() {
return g_shared_instance_for_test ? g_shared_instance_for_test
: g_lazy_instance.Get().api.get();
: g_extension_api_static.Get().api.get();
}
// static
......
......@@ -23,10 +23,11 @@ namespace extensions {
namespace {
class Static {
class FeatureProviderStatic {
public:
Static() {
TRACE_EVENT0("startup", "extensions::FeatureProvider::Static");
FeatureProviderStatic() {
TRACE_EVENT0("startup",
"extensions::FeatureProvider::FeatureProviderStatic");
base::Time begin_time = base::Time::Now();
ExtensionsClient* client = ExtensionsClient::Get();
......@@ -61,10 +62,11 @@ class Static {
private:
std::map<std::string, std::unique_ptr<FeatureProvider>> feature_providers_;
DISALLOW_COPY_AND_ASSIGN(Static);
DISALLOW_COPY_AND_ASSIGN(FeatureProviderStatic);
};
base::LazyInstance<Static>::Leaky g_static = LAZY_INSTANCE_INITIALIZER;
base::LazyInstance<FeatureProviderStatic>::Leaky g_feature_provider_static =
LAZY_INSTANCE_INITIALIZER;
const Feature* GetFeatureFromProviderByName(const std::string& provider_name,
const std::string& feature_name) {
......@@ -84,7 +86,7 @@ FeatureProvider::~FeatureProvider() {}
// static
const FeatureProvider* FeatureProvider::GetByName(const std::string& name) {
return g_static.Get().GetFeatures(name);
return g_feature_provider_static.Get().GetFeatures(name);
}
// static
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment