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

Unified Diff: base/at_exit.cc

Issue 2309153002: Remove RenderThreadImpl::Shutdown (Closed)
Patch Set: temp Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: base/at_exit.cc
diff --git a/base/at_exit.cc b/base/at_exit.cc
index cfe4cf9a587cc3da54e0ec3bc693e860beec425c..5dcc83cb2f5c390ab8cdbc19ba601ec3fd01ab0b 100644
--- a/base/at_exit.cc
+++ b/base/at_exit.cc
@@ -22,6 +22,8 @@ namespace base {
// this for thread-safe access, since it will only be modified in testing.
static AtExitManager* g_top_manager = NULL;
+static bool g_disable_managers = false;
+
AtExitManager::AtExitManager()
: processing_callbacks_(false), next_manager_(g_top_manager) {
// If multiple modules instantiate AtExitManagers they'll end up living in this
@@ -39,7 +41,8 @@ AtExitManager::~AtExitManager() {
}
DCHECK_EQ(this, g_top_manager);
- ProcessCallbacksNow();
+ if (!g_disable_managers)
+ ProcessCallbacksNow();
g_top_manager = next_manager_;
}
@@ -88,6 +91,11 @@ void AtExitManager::ProcessCallbacksNow() {
DCHECK(g_top_manager->stack_.empty());
}
+void AtExitManager::DisableAllAtExitManagers() {
+ AutoLock lock(g_top_manager->lock_);
+ g_disable_managers = true;
+}
+
AtExitManager::AtExitManager(bool shadow)
: processing_callbacks_(false), next_manager_(g_top_manager) {
DCHECK(shadow || !g_top_manager);

Powered by Google App Engine
This is Rietveld 408576698