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

Side by Side Diff: base/at_exit.cc

Issue 7344022: Add COMPONENT_BUILD global define. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/base.gypi » ('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) 2011 The Chromium Authors. All rights reserved. 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 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 // Keep a stack of registered AtExitManagers. We always operate on the most 14 // Keep a stack of registered AtExitManagers. We always operate on the most
15 // recent, and we should never have more than one outside of testing (for a 15 // recent, and we should never have more than one outside of testing (for a
16 // statically linked version of this library). Testing may use the shadow 16 // statically linked version of this library). Testing may use the shadow
17 // version of the constructor, and if we are building a dynamic library we may 17 // version of the constructor, and if we are building a dynamic library we may
18 // end up with multiple AtExitManagers on the same process. We don't protect 18 // end up with multiple AtExitManagers on the same process. We don't protect
19 // this for thread-safe access, since it will only be modified in testing. 19 // this for thread-safe access, since it will only be modified in testing.
20 static AtExitManager* g_top_manager = NULL; 20 static AtExitManager* g_top_manager = NULL;
21 21
22 AtExitManager::AtExitManager() : next_manager_(g_top_manager) { 22 AtExitManager::AtExitManager() : next_manager_(g_top_manager) {
23 // If multiple modules instantiate AtExitManagers they'll end up living in this 23 // If multiple modules instantiate AtExitManagers they'll end up living in this
24 // module... they have to coexist. 24 // module... they have to coexist.
25 #if !defined(BASE_DLL) 25 #if !defined(COMPONENT_BUILD)
26 DCHECK(!g_top_manager); 26 DCHECK(!g_top_manager);
27 #endif 27 #endif
28 g_top_manager = this; 28 g_top_manager = this;
29 } 29 }
30 30
31 AtExitManager::~AtExitManager() { 31 AtExitManager::~AtExitManager() {
32 if (!g_top_manager) { 32 if (!g_top_manager) {
33 NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager"; 33 NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager";
34 return; 34 return;
35 } 35 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 callback_and_param.func_(callback_and_param.param_); 68 callback_and_param.func_(callback_and_param.param_);
69 } 69 }
70 } 70 }
71 71
72 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) { 72 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) {
73 DCHECK(shadow || !g_top_manager); 73 DCHECK(shadow || !g_top_manager);
74 g_top_manager = this; 74 g_top_manager = this;
75 } 75 }
76 76
77 } // namespace base 77 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/base.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698