Lgtm On Mar 26, 2012 10:42 PM, <thakis@chromium.org> wrote: > Reviewers: rogerta1, > > Description: > Remove a static initializer from rlz. > > BUG=chromium:120335 > > > Please review this at https://codereview.appspot.**com/5918044/<https://codereview.appspot.com/5918... > > Affected files: > M lib/rlz_lib.cc > M lib/rlz_lib.h > > > Index: lib/rlz_lib.cc > diff --git a/lib/rlz_lib.cc b/lib/rlz_lib.cc > index 233f52d291d16fa9a7a5a832a60e0c**d67397f001..** > 67168e5f4fc2d5b6ae2a283098c86f**27756acef3 100644 > --- a/lib/rlz_lib.cc > +++ b/lib/rlz_lib.cc > @@ -7,6 +7,7 @@ > > #include "rlz/lib/rlz_lib.h" > > +#include "base/lazy_instance.h" > #include "base/string_util.h" > #include "base/stringprintf.h" > #include "rlz/lib/assert.h" > @@ -682,12 +683,14 @@ bool GetPingParams(Product product, const > AccessPoint* access_points, > return true; > } > > +static base::LazyInstance<std::**string>::Leaky g_supplemental_branding; > + > SupplementaryBranding::**SupplementaryBranding(const char* brand) > : lock_(new ScopedRlzValueStoreLock) { > if (!lock_->GetStore()) > return; > > - if (!brand_.empty()) { > + if (!g_supplemental_branding.Get(**).empty()) { > ASSERT_STRING("**ProductBranding: existing brand is not empty"); > return; > } > @@ -697,15 +700,18 @@ SupplementaryBranding::**SupplementaryBranding(const > char* brand) > return; > } > > - brand_ = brand; > + g_supplemental_branding.Get() = brand; > } > > SupplementaryBranding::~**SupplementaryBranding() { > if (lock_->GetStore()) > - brand_.clear(); > + g_supplemental_branding.Get().**clear(); > delete lock_; > } > > -std::string SupplementaryBranding::brand_; > +// static > +const std::string& SupplementaryBranding::**GetBrand() { > + return g_supplemental_branding.Get(); > +} > > } // namespace rlz_lib > Index: lib/rlz_lib.h > diff --git a/lib/rlz_lib.h b/lib/rlz_lib.h > index 0a8f5119dad380a0019c538ba711bb**af9bd1037e..** > 129f35a6c972e7e1a4f0e47954f9c8**cba887b3b6 100644 > --- a/lib/rlz_lib.h > +++ b/lib/rlz_lib.h > @@ -324,12 +324,10 @@ class SupplementaryBranding { > SupplementaryBranding(const char* brand); > ~SupplementaryBranding(); > > - static const std::string& GetBrand() { return brand_; } > + static const std::string& GetBrand(); > > private: > ScopedRlzValueStoreLock* lock_; > - > - static std::string brand_; > }; > > } // namespace rlz_lib > > >