OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import "components/crash/core/common/objc_zombie.h" | 5 #import "components/crash/core/common/objc_zombie.h" |
6 | 6 |
7 #include <AvailabilityMacros.h> | 7 #include <AvailabilityMacros.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <execinfo.h> | 10 #include <execinfo.h> |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 Class g_zombieClass = Nil; // cached [CrZombie class] | 67 Class g_zombieClass = Nil; // cached [CrZombie class] |
68 Class g_fatZombieClass = Nil; // cached [CrFatZombie class] | 68 Class g_fatZombieClass = Nil; // cached [CrFatZombie class] |
69 size_t g_fatZombieSize = 0; | 69 size_t g_fatZombieSize = 0; |
70 | 70 |
71 // Whether to zombie all freed objects, or only those which return YES | 71 // Whether to zombie all freed objects, or only those which return YES |
72 // from |-shouldBecomeCrZombie|. | 72 // from |-shouldBecomeCrZombie|. |
73 BOOL g_zombieAllObjects = NO; | 73 BOOL g_zombieAllObjects = NO; |
74 | 74 |
75 // Protects |g_zombieCount|, |g_zombieIndex|, and |g_zombies|. | 75 // Protects |g_zombieCount|, |g_zombieIndex|, and |g_zombies|. |
76 base::Lock& GetLock() { | 76 base::Lock& GetLock() { |
77 static auto lock = new base::Lock(); | 77 static auto* lock = new base::Lock(); |
78 return *lock; | 78 return *lock; |
79 } | 79 } |
80 | 80 |
81 // How many zombies to keep before freeing, and the current head of | 81 // How many zombies to keep before freeing, and the current head of |
82 // the circular buffer. | 82 // the circular buffer. |
83 size_t g_zombieCount = 0; | 83 size_t g_zombieCount = 0; |
84 size_t g_zombieIndex = 0; | 84 size_t g_zombieIndex = 0; |
85 | 85 |
86 typedef struct { | 86 typedef struct { |
87 id object; // The zombied object. | 87 id object; // The zombied object. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (oldZombies) { | 428 if (oldZombies) { |
429 for (size_t i = 0; i < oldCount; ++i) { | 429 for (size_t i = 0; i < oldCount; ++i) { |
430 if (oldZombies[i].object) | 430 if (oldZombies[i].object) |
431 object_dispose(oldZombies[i].object); | 431 object_dispose(oldZombies[i].object); |
432 } | 432 } |
433 free(oldZombies); | 433 free(oldZombies); |
434 } | 434 } |
435 } | 435 } |
436 | 436 |
437 } // namespace ObjcEvilDoers | 437 } // namespace ObjcEvilDoers |
OLD | NEW |