diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 13:31:49 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-15 13:31:49 +0000 |
commit | 6de0fd1d935e8c6c9257f1082dbd227acb1a06b1 (patch) | |
tree | 0ed5bc4ef9c2da0b498c30e562218f4528eaac9e /content/public | |
parent | 0f86c358fdb5e47aa9cd4a99b12da5e66507d080 (diff) | |
download | chromium_src-6de0fd1d935e8c6c9257f1082dbd227acb1a06b1.zip chromium_src-6de0fd1d935e8c6c9257f1082dbd227acb1a06b1.tar.gz chromium_src-6de0fd1d935e8c6c9257f1082dbd227acb1a06b1.tar.bz2 |
Allow linker initialization of lazy instance
Using the initializer list construct = {0} allows the object to be linker initialized.
Modify the LazyInstance class design to make it a pod aggregate type that can be linker initialized this way. Also combines the instance and state members, in line with the Singleton<> class design.
Introduces a new LAZY_INSTANCE_INITIALIZER macro specifically for using to init all lazy instances + modify all existing callsites to use it. (Old code would no longer compile)
BUG=94925
TEST=existing tests pass. http://build.chromium.org/f/chromium/perf/linux-release/sizes/report.html?history=150&header=chrome-si&graph=chrome-si&rev=-1 should step downward.
TBR=jam@chromium.org,rvargas@chromium.org,darin@chromium.org,ben@chromium.org,apatrick@chromium.org,akalin@chromium.org
Review URL: http://codereview.chromium.org/8491043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/renderer/render_thread.cc | 4 | ||||
-rw-r--r-- | content/public/renderer/render_view_observer_tracker.h | 2 | ||||
-rw-r--r-- | content/public/utility/utility_thread.cc | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/content/public/renderer/render_thread.cc b/content/public/renderer/render_thread.cc index ea04fd2..ef04a50 100644 --- a/content/public/renderer/render_thread.cc +++ b/content/public/renderer/render_thread.cc @@ -11,8 +11,8 @@ namespace content { // Keep the global RenderThread in a TLS slot so it is impossible to access // incorrectly from the wrong thread. -static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls( - base::LINKER_INITIALIZED); +static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls = + LAZY_INSTANCE_INITIALIZER; RenderThread* RenderThread::Get() { return lazy_tls.Pointer()->Get(); diff --git a/content/public/renderer/render_view_observer_tracker.h b/content/public/renderer/render_view_observer_tracker.h index 5f719d1..4ea322b 100644 --- a/content/public/renderer/render_view_observer_tracker.h +++ b/content/public/renderer/render_view_observer_tracker.h @@ -61,7 +61,7 @@ class RenderViewObserverTracker { template <class T> base::LazyInstance<std::map<const RenderView*, T*> > - RenderViewObserverTracker<T>::render_view_map_(base::LINKER_INITIALIZED); + RenderViewObserverTracker<T>::render_view_map_ = LAZY_INSTANCE_INITIALIZER; } // namespace content diff --git a/content/public/utility/utility_thread.cc b/content/public/utility/utility_thread.cc index 4da5bfb..bc4bd30 100644 --- a/content/public/utility/utility_thread.cc +++ b/content/public/utility/utility_thread.cc @@ -11,8 +11,8 @@ namespace content { // Keep the global UtilityThread in a TLS slot so it is impossible to access // incorrectly from the wrong thread. -static base::LazyInstance<base::ThreadLocalPointer<UtilityThread> > lazy_tls( - base::LINKER_INITIALIZED); +static base::LazyInstance<base::ThreadLocalPointer<UtilityThread> > lazy_tls = + LAZY_INSTANCE_INITIALIZER; UtilityThread* UtilityThread::Get() { return lazy_tls.Pointer()->Get(); |