Update V8 to version 4.6.52.
[chromium-blink-merge.git] / ui / base / win / atl_module.h
blobf677b435c64ad49ebaea1175abf762889847aeaf
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.
5 #ifndef UI_BASE_WIN_ATL_MODULE_H_
6 #define UI_BASE_WIN_ATL_MODULE_H_
8 #include <atlbase.h>
9 #include <atlcom.h>
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/macros.h"
15 namespace ui {
16 namespace win {
18 // Ensure that we have exactly one ATL module registered. It's safe to
19 // call this more than once. ATL functions will crash if there's no
20 // ATL module registered, or if you try to register two of them, so
21 // dynamically registering one if needed makes it much easier for us
22 // to support different build configurations like multi-dll without
23 // worrying about which side of a module boundary each ATL module object
24 // belongs on.
26 // This function must be implemented in this header file rather than a
27 // source file so that it's inlined into the module where it's included,
28 // rather than in the "ui" module.
29 inline void CreateATLModuleIfNeeded() {
30 if (_pAtlModule == NULL) {
31 // This creates the module and automatically updates _pAtlModule.
32 new CComModule;
36 } // namespace win
37 } // namespace ui
39 #endif // UI_BASE_WIN_ATL_MODULE_H_