summaryrefslogtreecommitdiffstats
path: root/gfx
diff options
context:
space:
mode:
authorsatish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-04 23:00:10 +0000
committersatish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-04 23:00:10 +0000
commit864b558217c75dbdebea9db3568056292d4cd274 (patch)
tree06bd9f240065ed47fab9ff415ae4cd49f21facf1 /gfx
parent8c9e61a02aad4d8baa0f75ae7ac2f2f1963fffd6 (diff)
downloadchromium_src-864b558217c75dbdebea9db3568056292d4cd274.zip
chromium_src-864b558217c75dbdebea9db3568056292d4cd274.tar.gz
chromium_src-864b558217c75dbdebea9db3568056292d4cd274.tar.bz2
This CL add a GetInstance() method to singleton classes instead of relying on the callers to use Singleton<T>.
In some cases I have used the LazyInstance<T> pattern as that was simpler. This is a small step towards making all singleton classes use the Singleton<T> pattern within their code and not expect the callers to know about it. I have selected all files under src/app and src/base which use Singleton<T> in this CL. Once this CL goes in I'll work on the rest of the files. BUG=65298 TEST=all existing tests should continue to pass. Review URL: http://codereview.chromium.org/5527004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68300 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r--gfx/window_impl.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gfx/window_impl.cc b/gfx/window_impl.cc
index 74e0e20..95561ff 100644
--- a/gfx/window_impl.cc
+++ b/gfx/window_impl.cc
@@ -42,6 +42,10 @@ struct ClassInfo {
class ClassRegistrar {
public:
+ static ClassRegistrar* GetInstance() {
+ return Singleton<ClassRegistrar>::get();
+ }
+
~ClassRegistrar() {
for (RegisteredClasses::iterator i = registered_classes_.begin();
i != registered_classes_.end(); ++i) {
@@ -198,7 +202,7 @@ LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd,
std::wstring WindowImpl::GetWindowClassName() {
ClassInfo class_info(initial_class_style());
std::wstring name;
- if (Singleton<ClassRegistrar>()->RetrieveClassName(class_info, &name))
+ if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name))
return name;
// No class found, need to register one.