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

Side by Side Diff: base/win/atl_module.h

Issue 8467002: Fix double-initialization of CComModule. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(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 BASE_WIN_ATL_MODULE_H_
6 #define BASE_WIN_ATL_MODULE_H_
7 #pragma once
8
9 namespace base {
10 namespace win {
11
12 // Ensure that we have exactly one CComModule registered. It's safe to
13 // call this more than once. ATL functions will crash if there's no
14 // CComModule registered, or if you try to register two of them, so
15 // dynamically registering one if needed makes it much easier for us
16 // to support different build configurations like multi-dll without
17 // worrying about which side of a module boundary each ATL module object
18 // belongs on. Also note that CAppModule is a subclass of CComModule
19 // that registers itself (among other things). This function must be
20 // implemented in this header file rather than a source file so that
21 // it's inlined into the module where it's included, rather than in
22 // the "base" module.
23 void CreateATLModuleIfNeeded() {
24 if (_pAtlModule == NULL) {
25 static CComModule module;
26 _pAtlModule = &module;
27 }
28 }
29
30 } // namespace win
31 } // namespace base
32
33 #endif // BASE_WIN_ATL_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698