OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef BASE_AT_EXIT_H_ | 5 #ifndef BASE_AT_EXIT_H_ |
6 #define BASE_AT_EXIT_H_ | 6 #define BASE_AT_EXIT_H_ |
7 | 7 |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // } | 25 // } |
26 // When the exit_manager object goes out of scope, all the registered | 26 // When the exit_manager object goes out of scope, all the registered |
27 // callbacks and singleton destructors will be called. | 27 // callbacks and singleton destructors will be called. |
28 | 28 |
29 class AtExitManager { | 29 class AtExitManager { |
30 protected: | 30 protected: |
31 // This constructor will allow this instance of AtExitManager to be created | 31 // This constructor will allow this instance of AtExitManager to be created |
32 // even if one already exists. This should only be used for testing! | 32 // even if one already exists. This should only be used for testing! |
33 // AtExitManagers are kept on a global stack, and it will be removed during | 33 // AtExitManagers are kept on a global stack, and it will be removed during |
34 // destruction. This allows you to shadow another AtExitManager. | 34 // destruction. This allows you to shadow another AtExitManager. |
35 AtExitManager(bool shadow); | 35 explicit AtExitManager(bool shadow); |
36 | 36 |
37 public: | 37 public: |
38 typedef void (*AtExitCallbackType)(void*); | 38 typedef void (*AtExitCallbackType)(void*); |
39 | 39 |
40 AtExitManager(); | 40 AtExitManager(); |
41 | 41 |
42 // The dtor calls all the registered callbacks. Do not try to register more | 42 // The dtor calls all the registered callbacks. Do not try to register more |
43 // callbacks after this point. | 43 // callbacks after this point. |
44 ~AtExitManager(); | 44 ~AtExitManager(); |
45 | 45 |
(...skipping 23 matching lines...) Expand all Loading... |
69 #if defined(UNIT_TEST) | 69 #if defined(UNIT_TEST) |
70 class ShadowingAtExitManager : public AtExitManager { | 70 class ShadowingAtExitManager : public AtExitManager { |
71 public: | 71 public: |
72 ShadowingAtExitManager() : AtExitManager(true) {} | 72 ShadowingAtExitManager() : AtExitManager(true) {} |
73 }; | 73 }; |
74 #endif // defined(UNIT_TEST) | 74 #endif // defined(UNIT_TEST) |
75 | 75 |
76 } // namespace base | 76 } // namespace base |
77 | 77 |
78 #endif // BASE_AT_EXIT_H_ | 78 #endif // BASE_AT_EXIT_H_ |
OLD | NEW |