diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-11 10:23:37 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-11 10:23:37 +0000 |
commit | 5820d2f0458c851b18df616ef3aff80cb4f8dba4 (patch) | |
tree | dda803c05296f1bd8ee622c6d708a494373dcd1a /skia | |
parent | 9acd869ec5621373757a6959310f39e1f5ec3f3d (diff) | |
download | chromium_src-5820d2f0458c851b18df616ef3aff80cb4f8dba4.zip chromium_src-5820d2f0458c851b18df616ef3aff80cb4f8dba4.tar.gz chromium_src-5820d2f0458c851b18df616ef3aff80cb4f8dba4.tar.bz2 |
Revert 68932 - Make members of Singleton<T> private and only visible to the singleton type. This enforces that the Singleton<T> pattern can only be used within classes which want singleton-ness.
As part of this CL I have also fixed up files which got missed in my previous CLs to use a GetInstance() method and use Singleton<T> from the source file.
There are a small number of places where I have also switched to LazyInstance as that was more appropriate for types used in a single source file.
BUG=65298
TEST=all existing tests should continue to pass.
Review URL: http://codereview.chromium.org/5682008
TBR=satish@chromium.org
Review URL: http://codereview.chromium.org/5721005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/vector_platform_device_linux.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/skia/ext/vector_platform_device_linux.cc b/skia/ext/vector_platform_device_linux.cc index 4bf5fd1..3d45596 100644 --- a/skia/ext/vector_platform_device_linux.cc +++ b/skia/ext/vector_platform_device_linux.cc @@ -12,8 +12,8 @@ #include <map> -#include "base/lazy_instance.h" #include "base/logging.h" +#include "base/singleton.h" #include "skia/ext/bitmap_platform_device.h" #include "third_party/skia/include/core/SkFontHost.h" #include "third_party/skia/include/core/SkStream.h" @@ -29,8 +29,6 @@ struct FontInfo { }; typedef std::map<uint32_t, FontInfo> MapFontId2FontInfo; -static base::LazyInstance<MapFontId2FontInfo> g_map_font_id_to_font_info( - base::LINKER_INITIALIZED); // Wrapper for FT_Library that handles initialization and cleanup, and allows // us to use a singleton. @@ -57,7 +55,6 @@ class FtLibrary { private: FT_Library library_; }; -static base::LazyInstance<FtLibrary> g_ft_library(base::LINKER_INITIALIZED); // Verify cairo surface after creation/modification. bool IsContextValid(cairo_t* context) { @@ -595,12 +592,12 @@ bool VectorPlatformDevice::SelectFontById(uint32_t font_id) { DCHECK(IsContextValid(context_)); DCHECK(SkFontHost::ValidFontID(font_id)); - FtLibrary* ft_library = g_ft_library.Pointer(); + FtLibrary* ft_library = Singleton<FtLibrary>::get(); if (!ft_library->library()) return false; // Checks if we have a cache hit. - MapFontId2FontInfo* g_font_cache = g_map_font_id_to_font_info.Pointer(); + MapFontId2FontInfo* g_font_cache = Singleton<MapFontId2FontInfo>::get(); DCHECK(g_font_cache); MapFontId2FontInfo::iterator it = g_font_cache->find(font_id); @@ -670,7 +667,7 @@ bool VectorPlatformDevice::SelectFontById(uint32_t font_id) { // static void VectorPlatformDevice::ClearFontCache() { - MapFontId2FontInfo* g_font_cache = g_map_font_id_to_font_info.Pointer(); + MapFontId2FontInfo* g_font_cache = Singleton<MapFontId2FontInfo>::get(); DCHECK(g_font_cache); for (MapFontId2FontInfo::iterator it = g_font_cache->begin(); |