OLD | NEW |
1 // Copyright (c) 2006-2008 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 |
| 7 #include <stddef.h> |
| 8 #include <ostream> |
| 9 |
6 #include "base/logging.h" | 10 #include "base/logging.h" |
7 | 11 |
8 namespace base { | 12 namespace base { |
9 | 13 |
10 // 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 |
11 // recent, and we should never have more than one outside of testing, when we | 15 // recent, and we should never have more than one outside of testing, when we |
12 // use the shadow version of the constructor. We don't protect this for | 16 // use the shadow version of the constructor. We don't protect this for |
13 // thread-safe access, since it will only be modified in testing. | 17 // thread-safe access, since it will only be modified in testing. |
14 static AtExitManager* g_top_manager = NULL; | 18 static AtExitManager* g_top_manager = NULL; |
15 | 19 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 callback_and_param.func_(callback_and_param.param_); | 62 callback_and_param.func_(callback_and_param.param_); |
59 } | 63 } |
60 } | 64 } |
61 | 65 |
62 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) { | 66 AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) { |
63 DCHECK(shadow || !g_top_manager); | 67 DCHECK(shadow || !g_top_manager); |
64 g_top_manager = this; | 68 g_top_manager = this; |
65 } | 69 } |
66 | 70 |
67 } // namespace base | 71 } // namespace base |
OLD | NEW |