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

Side by Side Diff: chrome/browser/cocoa/objc_zombie.mm

Issue 2865003: Working towards -Wextra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/cocoa/objc_zombie.h" 5 #import "chrome/browser/cocoa/objc_zombie.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <mach-o/dyld.h> 8 #include <mach-o/dyld.h>
9 #include <mach-o/nlist.h> 9 #include <mach-o/nlist.h>
10 10
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 BOOL ZombieEnable(BOOL zombieAllObjects, 269 BOOL ZombieEnable(BOOL zombieAllObjects,
270 size_t zombieCount) { 270 size_t zombieCount) {
271 // Only allow enable/disable on the main thread, just to keep things 271 // Only allow enable/disable on the main thread, just to keep things
272 // simple. 272 // simple.
273 CHECK([NSThread isMainThread]); 273 CHECK([NSThread isMainThread]);
274 274
275 if (!ZombieInit()) 275 if (!ZombieInit())
276 return NO; 276 return NO;
277 277
278 if (zombieCount < 0)
279 return NO;
280
281 g_zombieAllObjects = zombieAllObjects; 278 g_zombieAllObjects = zombieAllObjects;
282 279
283 // Replace the implementation of -[NSObject dealloc]. 280 // Replace the implementation of -[NSObject dealloc].
284 Method m = class_getInstanceMethod([NSObject class], @selector(dealloc)); 281 Method m = class_getInstanceMethod([NSObject class], @selector(dealloc));
285 if (!m) 282 if (!m)
286 return NO; 283 return NO;
287 284
288 const IMP prevDeallocIMP = method_setImplementation(m, (IMP)ZombieDealloc); 285 const IMP prevDeallocIMP = method_setImplementation(m, (IMP)ZombieDealloc);
289 DCHECK(prevDeallocIMP == g_originalDeallocIMP || 286 DCHECK(prevDeallocIMP == g_originalDeallocIMP ||
290 prevDeallocIMP == (IMP)ZombieDealloc); 287 prevDeallocIMP == (IMP)ZombieDealloc);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (oldZombies) { 372 if (oldZombies) {
376 for (size_t i = 0; i < oldCount; ++i) { 373 for (size_t i = 0; i < oldCount; ++i) {
377 if (oldZombies[i].object) 374 if (oldZombies[i].object)
378 free(oldZombies[i].object); 375 free(oldZombies[i].object);
379 } 376 }
380 free(oldZombies); 377 free(oldZombies);
381 } 378 }
382 } 379 }
383 380
384 } // namespace ObjcEvilDoers 381 } // namespace ObjcEvilDoers
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/privacy_blacklist/blacklist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698