| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_COCOA_NSOBJECT_ZOMBIE_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_NSOBJECT_ZOMBIE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #import <Foundation/Foundation.h> | |
| 10 | |
| 11 // You should think twice every single time you use anything from this | |
| 12 // namespace. | |
| 13 namespace ObjcEvilDoers { | |
| 14 | |
| 15 // Enable zombie object debugging. This implements a variant of Apple's | |
| 16 // NSZombieEnabled which can help expose use-after-free errors where messages | |
| 17 // are sent to freed Objective-C objects in production builds. | |
| 18 // | |
| 19 // Returns NO if it fails to enable. | |
| 20 // | |
| 21 // When |zombieAllObjects| is YES, all objects inheriting from | |
| 22 // NSObject become zombies on -dealloc. If NO, -shouldBecomeCrZombie | |
| 23 // is queried to determine whether to make the object a zombie. | |
| 24 // | |
| 25 // |zombieCount| controls how many zombies to store before freeing the | |
| 26 // oldest. Set to 0 to free objects immediately after making them | |
| 27 // zombies. | |
| 28 BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount); | |
| 29 | |
| 30 // Disable zombies. | |
| 31 void ZombieDisable(); | |
| 32 | |
| 33 } // namespace ObjcEvilDoers | |
| 34 | |
| 35 @interface NSObject (CrZombie) | |
| 36 - (BOOL)shouldBecomeCrZombie; | |
| 37 @end | |
| 38 | |
| 39 #endif // CHROME_BROWSER_UI_COCOA_NSOBJECT_ZOMBIE_H_ | |
| OLD | NEW |