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

Unified Diff: chrome/common/mac/objc_zombie.mm

Issue 8468018: chrome: Remove 10 exit time destructors and 2 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: duh Created 9 years, 1 month 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
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/common/metrics_helpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/mac/objc_zombie.mm
diff --git a/chrome/common/mac/objc_zombie.mm b/chrome/common/mac/objc_zombie.mm
index 452aa6f5b34e629a790172970ce33ea05dc3ff0e..d0651097e66e4dbad10cf05a790b88bbdcaddd1e 100644
--- a/chrome/common/mac/objc_zombie.mm
+++ b/chrome/common/mac/objc_zombie.mm
@@ -15,6 +15,7 @@
#include <iostream>
#include "base/debug/stack_trace.h"
+#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/mac/crash_logging.h"
#include "base/mac/mac_util.h"
@@ -75,7 +76,8 @@ size_t g_fatZombieSize = 0;
BOOL g_zombieAllObjects = NO;
// Protects |g_zombieCount|, |g_zombieIndex|, and |g_zombies|.
-base::Lock lock_;
+base::LazyInstance<base::Lock, base::LeakyLazyInstanceTraits<base::Lock> >
+ g_lock = LAZY_INSTANCE_INITIALIZER;
// How many zombies to keep before freeing, and the current head of
// the circular buffer.
@@ -213,7 +215,7 @@ void ZombieDealloc(id self, SEL _cmd) {
// Don't involve the lock when creating zombies without a treadmill.
if (g_zombieCount > 0) {
- base::AutoLock pin(lock_);
+ base::AutoLock pin(g_lock.Get());
// Check the count again in a thread-safe manner.
if (g_zombieCount > 0) {
@@ -236,7 +238,7 @@ void ZombieDealloc(id self, SEL _cmd) {
BOOL GetZombieRecord(id object, ZombieRecord* record) {
// Holding the lock is reasonable because this should be fast, and
// the process is going to crash presently anyhow.
- base::AutoLock pin(lock_);
+ base::AutoLock pin(g_lock.Get());
for (size_t i = 0; i < g_zombieCount; ++i) {
if (g_zombies[i].object == object) {
*record = g_zombies[i];
@@ -472,7 +474,7 @@ bool ZombieEnable(bool zombieAllObjects,
ZombieRecord* oldZombies = g_zombies;
{
- base::AutoLock pin(lock_);
+ base::AutoLock pin(g_lock.Get());
// Save the old index in case zombies need to be transferred.
size_t oldIndex = g_zombieIndex;
@@ -543,7 +545,7 @@ void ZombieDisable() {
ZombieRecord* oldZombies = g_zombies;
{
- base::AutoLock pin(lock_); // In case any |-dealloc| are in-progress.
+ base::AutoLock pin(g_lock.Get()); // In case any -dealloc are in progress.
g_zombieCount = 0;
g_zombies = NULL;
}
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/common/metrics_helpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698