Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: ui/gfx/win/window_impl.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/win/singleton_hwnd.cc ('k') | ui/gl/gpu_switching_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/win/window_impl.h" 5 #include "ui/gfx/win/window_impl.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 base::string16 name; 74 base::string16 name;
75 75
76 // The atom identifying the window class. 76 // The atom identifying the window class.
77 ATOM atom; 77 ATOM atom;
78 78
79 // The handle of the module containing the window proceedure. 79 // The handle of the module containing the window proceedure.
80 HMODULE instance; 80 HMODULE instance;
81 }; 81 };
82 82
83 ClassRegistrar(); 83 ClassRegistrar();
84 friend struct DefaultSingletonTraits<ClassRegistrar>; 84 friend struct base::DefaultSingletonTraits<ClassRegistrar>;
85 85
86 typedef std::list<RegisteredClass> RegisteredClasses; 86 typedef std::list<RegisteredClass> RegisteredClasses;
87 RegisteredClasses registered_classes_; 87 RegisteredClasses registered_classes_;
88 88
89 // Counter of how many classes have been registered so far. 89 // Counter of how many classes have been registered so far.
90 int registered_count_; 90 int registered_count_;
91 91
92 base::Lock lock_; 92 base::Lock lock_;
93 93
94 DISALLOW_COPY_AND_ASSIGN(ClassRegistrar); 94 DISALLOW_COPY_AND_ASSIGN(ClassRegistrar);
95 }; 95 };
96 96
97 ClassRegistrar::~ClassRegistrar() {} 97 ClassRegistrar::~ClassRegistrar() {}
98 98
99 // static 99 // static
100 ClassRegistrar* ClassRegistrar::GetInstance() { 100 ClassRegistrar* ClassRegistrar::GetInstance() {
101 return Singleton<ClassRegistrar, 101 return base::Singleton<ClassRegistrar,
102 LeakySingletonTraits<ClassRegistrar> >::get(); 102 base::LeakySingletonTraits<ClassRegistrar>>::get();
103 } 103 }
104 104
105 void ClassRegistrar::UnregisterClasses() { 105 void ClassRegistrar::UnregisterClasses() {
106 for (RegisteredClasses::iterator i = registered_classes_.begin(); 106 for (RegisteredClasses::iterator i = registered_classes_.begin();
107 i != registered_classes_.end(); ++i) { 107 i != registered_classes_.end(); ++i) {
108 if (UnregisterClass(MAKEINTATOM(i->atom), i->instance)) { 108 if (UnregisterClass(MAKEINTATOM(i->atom), i->instance)) {
109 registered_classes_.erase(i); 109 registered_classes_.erase(i);
110 } else { 110 } else {
111 LOG(ERROR) << "Failed to unregister class " << i->name 111 LOG(ERROR) << "Failed to unregister class " << i->name
112 << ". Error = " << GetLastError(); 112 << ". Error = " << GetLastError();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 ATOM WindowImpl::GetWindowClassAtom() { 309 ATOM WindowImpl::GetWindowClassAtom() {
310 HICON icon = GetDefaultWindowIcon(); 310 HICON icon = GetDefaultWindowIcon();
311 HICON small_icon = GetSmallWindowIcon(); 311 HICON small_icon = GetSmallWindowIcon();
312 ClassInfo class_info(initial_class_style(), icon, small_icon); 312 ClassInfo class_info(initial_class_style(), icon, small_icon);
313 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info); 313 return ClassRegistrar::GetInstance()->RetrieveClassAtom(class_info);
314 } 314 }
315 315
316 } // namespace gfx 316 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/win/singleton_hwnd.cc ('k') | ui/gl/gpu_switching_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698