OLD | NEW |
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 #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/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 protected: | 52 protected: |
53 // This constructor will allow this instance of AtExitManager to be created | 53 // This constructor will allow this instance of AtExitManager to be created |
54 // even if one already exists. This should only be used for testing! | 54 // even if one already exists. This should only be used for testing! |
55 // AtExitManagers are kept on a global stack, and it will be removed during | 55 // AtExitManagers are kept on a global stack, and it will be removed during |
56 // destruction. This allows you to shadow another AtExitManager. | 56 // destruction. This allows you to shadow another AtExitManager. |
57 explicit AtExitManager(bool shadow); | 57 explicit AtExitManager(bool shadow); |
58 | 58 |
59 private: | 59 private: |
60 base::Lock lock_; | 60 base::Lock lock_; |
61 std::stack<base::Closure> stack_; | 61 std::stack<base::Closure> stack_; |
| 62 bool processing_callbacks_; |
62 AtExitManager* next_manager_; // Stack of managers to allow shadowing. | 63 AtExitManager* next_manager_; // Stack of managers to allow shadowing. |
63 | 64 |
64 DISALLOW_COPY_AND_ASSIGN(AtExitManager); | 65 DISALLOW_COPY_AND_ASSIGN(AtExitManager); |
65 }; | 66 }; |
66 | 67 |
67 #if defined(UNIT_TEST) | 68 #if defined(UNIT_TEST) |
68 class ShadowingAtExitManager : public AtExitManager { | 69 class ShadowingAtExitManager : public AtExitManager { |
69 public: | 70 public: |
70 ShadowingAtExitManager() : AtExitManager(true) {} | 71 ShadowingAtExitManager() : AtExitManager(true) {} |
71 }; | 72 }; |
72 #endif // defined(UNIT_TEST) | 73 #endif // defined(UNIT_TEST) |
73 | 74 |
74 } // namespace base | 75 } // namespace base |
75 | 76 |
76 #endif // BASE_AT_EXIT_H_ | 77 #endif // BASE_AT_EXIT_H_ |
OLD | NEW |