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.cc | |
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.cc')
-rw-r--r-- | base/at_exit.cc | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/base/at_exit.cc b/base/at_exit.cc index d853504..fb4e8c9 100644 --- a/base/at_exit.cc +++ b/base/at_exit.cc @@ -1,66 +1,66 @@ -// 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.
-
-#include "base/at_exit.h"
-#include "base/logging.h"
-
-namespace base {
-
-// Keep a stack of registered AtExitManagers. We always operate on the most
-// recent, and we should never have more than one outside of testing, when we
-// use the shadow version of the constructor. We don't protect this for
-// thread-safe access, since it will only be modified in testing.
-static AtExitManager* g_top_manager = NULL;
-
-AtExitManager::AtExitManager() : next_manager_(NULL) {
- DCHECK(!g_top_manager);
- g_top_manager = this;
-}
-
-AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) {
- DCHECK(shadow || !g_top_manager);
- g_top_manager = this;
-}
-
-AtExitManager::~AtExitManager() {
- if (!g_top_manager) {
- NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager";
- return;
- }
- DCHECK(g_top_manager == this);
-
- ProcessCallbacksNow();
- g_top_manager = next_manager_;
-}
-
-// static
-void AtExitManager::RegisterCallback(AtExitCallbackType func) {
- if (!g_top_manager) {
- NOTREACHED() << "Tried to RegisterCallback without an AtExitManager";
- return;
- }
-
- AutoLock lock(g_top_manager->lock_);
- g_top_manager->stack_.push(func);
-}
-
-// static
-void AtExitManager::ProcessCallbacksNow() {
- if (!g_top_manager) {
- NOTREACHED() << "Tried to ProcessCallbacksNow without an AtExitManager";
- return;
- }
-
- AutoLock lock(g_top_manager->lock_);
-
- while (!g_top_manager->stack_.empty()) {
- AtExitCallbackType func = g_top_manager->stack_.top();
- g_top_manager->stack_.pop();
- if (func)
- func();
- }
-}
-
-} // namespace base
-
+// 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. + +#include "base/at_exit.h" +#include "base/logging.h" + +namespace base { + +// Keep a stack of registered AtExitManagers. We always operate on the most +// recent, and we should never have more than one outside of testing, when we +// use the shadow version of the constructor. We don't protect this for +// thread-safe access, since it will only be modified in testing. +static AtExitManager* g_top_manager = NULL; + +AtExitManager::AtExitManager() : next_manager_(NULL) { + DCHECK(!g_top_manager); + g_top_manager = this; +} + +AtExitManager::AtExitManager(bool shadow) : next_manager_(g_top_manager) { + DCHECK(shadow || !g_top_manager); + g_top_manager = this; +} + +AtExitManager::~AtExitManager() { + if (!g_top_manager) { + NOTREACHED() << "Tried to ~AtExitManager without an AtExitManager"; + return; + } + DCHECK(g_top_manager == this); + + ProcessCallbacksNow(); + g_top_manager = next_manager_; +} + +// static +void AtExitManager::RegisterCallback(AtExitCallbackType func) { + if (!g_top_manager) { + NOTREACHED() << "Tried to RegisterCallback without an AtExitManager"; + return; + } + + AutoLock lock(g_top_manager->lock_); + g_top_manager->stack_.push(func); +} + +// static +void AtExitManager::ProcessCallbacksNow() { + if (!g_top_manager) { + NOTREACHED() << "Tried to ProcessCallbacksNow without an AtExitManager"; + return; + } + + AutoLock lock(g_top_manager->lock_); + + while (!g_top_manager->stack_.empty()) { + AtExitCallbackType func = g_top_manager->stack_.top(); + g_top_manager->stack_.pop(); + if (func) + func(); + } +} + +} // namespace base + |