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 /webkit/glue/plugins | |
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 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/pepper_graphics_3d.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/webkit/glue/plugins/pepper_graphics_3d.cc b/webkit/glue/plugins/pepper_graphics_3d.cc index 3e72c29..2dc4def 100644 --- a/webkit/glue/plugins/pepper_graphics_3d.cc +++ b/webkit/glue/plugins/pepper_graphics_3d.cc @@ -5,7 +5,7 @@ #include "webkit/glue/plugins/pepper_graphics_3d.h" #include "gpu/command_buffer/common/command_buffer.h" -#include "base/lazy_instance.h" +#include "base/singleton.h" #include "base/thread_local.h" #include "ppapi/c/dev/ppb_graphics_3d_dev.h" #include "webkit/glue/plugins/pepper_common.h" @@ -15,8 +15,10 @@ namespace pepper { namespace { -static base::LazyInstance<base::ThreadLocalPointer<Graphics3D> > - g_current_context_key(base::LINKER_INITIALIZED); +struct CurrentContextTag {}; +typedef Singleton<base::ThreadLocalPointer<Graphics3D>, + DefaultSingletonTraits<base::ThreadLocalPointer<Graphics3D> >, + CurrentContextTag> CurrentContextKey; // Size of the transfer buffer. enum { kTransferBufferSize = 512 * 1024 }; @@ -136,11 +138,11 @@ const PPB_Graphics3D_Dev* Graphics3D::GetInterface() { } Graphics3D* Graphics3D::GetCurrent() { - return g_current_context_key.Get().Get(); + return CurrentContextKey::get()->Get(); } void Graphics3D::ResetCurrent() { - g_current_context_key.Get().Set(NULL); + CurrentContextKey::get()->Set(NULL); } Graphics3D::~Graphics3D() { @@ -199,7 +201,7 @@ bool Graphics3D::MakeCurrent() { if (!platform_context_.get()) return false; - g_current_context_key.Get().Set(this); + CurrentContextKey::get()->Set(this); // TODO(apatrick): Return false on context lost. return true; |