diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-02 18:20:34 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-02 18:20:34 +0000 |
commit | b2e972938cc2a0478c33ff094c6f574f39c41997 (patch) | |
tree | cd985001cc7fd95db94ccda4bb5bede60d56f5ae /base/at_exit.h | |
parent | 844cbe038fca95d8a5406f895704076c402e4e29 (diff) | |
download | chromium_src-b2e972938cc2a0478c33ff094c6f574f39c41997.zip chromium_src-b2e972938cc2a0478c33ff094c6f574f39c41997.tar.gz chromium_src-b2e972938cc2a0478c33ff094c6f574f39c41997.tar.bz2 |
Set svn:eol-style = LF on files in base from which it is missing
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/at_exit.h')
-rw-r--r-- | base/at_exit.h | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/base/at_exit.h b/base/at_exit.h index 9a6daa9..94dff08 100644 --- a/base/at_exit.h +++ b/base/at_exit.h @@ -1,65 +1,65 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef BASE_AT_EXIT_H_
-#define BASE_AT_EXIT_H_
-
-#include <stack>
-
-#include "base/basictypes.h"
-#include "base/lock.h"
-
-namespace base {
-
-// This class provides a facility similar to the CRT atexit(), except that
-// we control when the callbacks are executed. Under Windows for a DLL they
-// happen at a really bad time and under the loader lock. This facility is
-// mostly used by base::Singleton.
-//
-// The usage is simple. Early in the main() or WinMain() scope create an
-// AtExitManager object on the stack:
-// int main(...) {
-// base::AtExitManager exit_manager;
-//
-// }
-// When the exit_manager object goes out of scope, all the registered
-// callbacks and singleton destructors will be called.
-
-class AtExitManager {
- protected:
- // This constructor will allow this instance of AtExitManager to be created
- // even if one already exists. This should only be used for testing!
- // AtExitManagers are kept on a global stack, and it will be removed during
- // destruction. This allows you to shadow another AtExitManager.
- AtExitManager(bool shadow);
-
- public:
- typedef void (*AtExitCallbackType)();
-
- AtExitManager();
-
- // The dtor calls all the registered callbacks. Do not try to register more
- // callbacks after this point.
- ~AtExitManager();
-
- // Registers the specified function to be called at exit. The prototype of
- // the callback function is void func().
- static void RegisterCallback(AtExitCallbackType func);
-
- // Calls the functions registered with RegisterCallback in LIFO order. It
- // is possible to register new callbacks after calling this function.
- static void ProcessCallbacksNow();
-
- private:
- Lock lock_;
- std::stack<AtExitCallbackType> stack_;
- AtExitManager* next_manager_; // Stack of managers to allow shadowing.
-
- DISALLOW_COPY_AND_ASSIGN(AtExitManager);
-};
-
-} // namespace base
-
-#endif // BASE_AT_EXIT_H_
-
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_AT_EXIT_H_ +#define BASE_AT_EXIT_H_ + +#include <stack> + +#include "base/basictypes.h" +#include "base/lock.h" + +namespace base { + +// This class provides a facility similar to the CRT atexit(), except that +// we control when the callbacks are executed. Under Windows for a DLL they +// happen at a really bad time and under the loader lock. This facility is +// mostly used by base::Singleton. +// +// The usage is simple. Early in the main() or WinMain() scope create an +// AtExitManager object on the stack: +// int main(...) { +// base::AtExitManager exit_manager; +// +// } +// When the exit_manager object goes out of scope, all the registered +// callbacks and singleton destructors will be called. + +class AtExitManager { + protected: + // This constructor will allow this instance of AtExitManager to be created + // even if one already exists. This should only be used for testing! + // AtExitManagers are kept on a global stack, and it will be removed during + // destruction. This allows you to shadow another AtExitManager. + AtExitManager(bool shadow); + + public: + typedef void (*AtExitCallbackType)(); + + AtExitManager(); + + // The dtor calls all the registered callbacks. Do not try to register more + // callbacks after this point. + ~AtExitManager(); + + // Registers the specified function to be called at exit. The prototype of + // the callback function is void func(). + static void RegisterCallback(AtExitCallbackType func); + + // Calls the functions registered with RegisterCallback in LIFO order. It + // is possible to register new callbacks after calling this function. + static void ProcessCallbacksNow(); + + private: + Lock lock_; + std::stack<AtExitCallbackType> stack_; + AtExitManager* next_manager_; // Stack of managers to allow shadowing. + + DISALLOW_COPY_AND_ASSIGN(AtExitManager); +}; + +} // namespace base + +#endif // BASE_AT_EXIT_H_ + |