Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_BASE_WIN_ATL_MODULE_H_ | |
| 6 #define UI_BASE_WIN_ATL_MODULE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <atlbase.h> | |
| 10 #include <atlcom.h> | |
| 11 | |
| 12 namespace ui { | |
| 13 namespace win { | |
| 14 | |
| 15 // Ensure that we have exactly one ATL module registered. It's safe to | |
| 16 // call this more than once. ATL functions will crash if there's no | |
| 17 // ATL module registered, or if you try to register two of them, so | |
| 18 // dynamically registering one if needed makes it much easier for us | |
| 19 // to support different build configurations like multi-dll without | |
| 20 // worrying about which side of a module boundary each ATL module object | |
| 21 // belongs on. | |
| 22 // | |
| 23 // This function must be implemented in this header file rather than a | |
| 24 // source file so that it's inlined into the module where it's included, | |
| 25 // rather than in the "base" module. | |
|
Nico
2011/11/14 16:21:13
"ui"
dmazzoni
2011/11/14 16:27:41
Done.
| |
| 26 static void CreateATLModuleIfNeeded() { | |
| 27 if (_pAtlModule == NULL) { | |
| 28 // This creates the module and automatically updates _pAtlModule. | |
| 29 static CComModule module; | |
|
Nico
2011/11/14 16:21:13
Does CComModule have a destructor? Can you think o
dmazzoni
2011/11/14 16:27:41
My understanding is that the destructor is useful
Nico
2011/11/14 16:34:28
Can we try if that works then?
| |
| 30 } | |
| 31 } | |
| 32 | |
| 33 } // namespace win | |
| 34 } // namespace ui | |
| 35 | |
| 36 #endif // UI_BASE_WIN_ATL_MODULE_H_ | |
| OLD | NEW |