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

Side by Side Diff: base/at_exit.h

Issue 1661673003: Fix AtExitManager recursive lock acquisition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment. Created 4 years, 10 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
« no previous file with comments | « no previous file | base/at_exit.cc » ('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 #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
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_
OLDNEW
« no previous file with comments | « no previous file | base/at_exit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698