Chromium Code Reviews| Index: ui/base/win/window_impl.cc |
| diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc |
| index dce0f2f7b6341723c1690a7ab69e9c02ef587830..580721a50f8e179c0c0bae87227835a2cbed98d0 100644 |
| --- a/ui/base/win/window_impl.cc |
| +++ b/ui/base/win/window_impl.cc |
| @@ -45,17 +45,11 @@ struct ClassInfo { |
| class ClassRegistrar { |
| public: |
| static ClassRegistrar* GetInstance() { |
|
Peter Kasting
2012/11/15 18:53:50
Nit: Would be good to de-inline this as well.
Als
Bernhard Bauer
2012/11/18 19:15:26
Done.
|
| - return Singleton<ClassRegistrar>::get(); |
| + return Singleton<ClassRegistrar, |
| + LeakySingletonTraits<ClassRegistrar> >::get(); |
| } |
| ~ClassRegistrar() { |
| - for (RegisteredClasses::iterator i = registered_classes_.begin(); |
| - i != registered_classes_.end(); ++i) { |
| - if (!UnregisterClass(MAKEINTATOM(i->atom), i->instance)) { |
| - LOG(ERROR) << "Failed to unregister class " << i->name.c_str() |
| - << ". Error = " << GetLastError(); |
|
cpu_(ooo_6.6-7.5)
2012/11/15 19:08:36
So we are leaking the classes, I would be ok with
Bernhard Bauer
2012/11/15 23:26:30
Hm, if I read http://crbug.com/113008 correct, we
Bernhard Bauer
2012/11/18 19:15:26
Ok, I ran unit_tests and I got only one registrati
|
| - } |
| - } |
| } |
| // Puts the name for the class matching |class_info| in |class_name|, creating |
| @@ -76,24 +70,17 @@ class ClassRegistrar { |
| } |
| void RegisterClass(const ClassInfo& class_info, |
| - const std::wstring& name, |
| - ATOM atom, |
| - HMODULE instance) { |
| - registered_classes_.push_back( |
| - RegisteredClass(class_info, name, atom, instance)); |
| + const std::wstring& name) { |
| + registered_classes_.push_back(RegisteredClass(class_info, name)); |
| } |
| private: |
| // Represents a registered window class. |
| struct RegisteredClass { |
| RegisteredClass(const ClassInfo& info, |
| - const std::wstring& name, |
| - ATOM atom, |
| - HMODULE instance) |
| + const std::wstring& name) |
| : info(info), |
| - name(name), |
| - atom(atom), |
| - instance(instance) { |
| + name(name) { |
| } |
| // Info used to create the class. |
| @@ -101,12 +88,6 @@ class ClassRegistrar { |
| // The name given to the window class. |
| std::wstring name; |
| - |
| - // The ATOM returned from registering the window class. |
|
cpu_(ooo_6.6-7.5)
2012/11/15 19:08:36
I would rather keep the atom and ditch the name.
Bernhard Bauer
2012/11/15 23:26:30
But we need the name to find classes by name, or a
|
| - ATOM atom; |
| - |
| - // The handle of the module containing the window procedure. |
| - HMODULE instance; |
| }; |
| ClassRegistrar() : registered_count_(0) { } |
| @@ -269,8 +250,7 @@ std::wstring WindowImpl::GetWindowClassName() { |
| ATOM atom = RegisterClassEx(&window_class); |
| CHECK(atom) << GetLastError(); |
| - ClassRegistrar::GetInstance()->RegisterClass( |
| - class_info, name, atom, instance); |
| + ClassRegistrar::GetInstance()->RegisterClass(class_info, name); |
| return name; |
| } |