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

Side by Side Diff: chrome/common/mac/objc_zombie.mm

Issue 10834059: mac: Remove one static initializer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 8 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/common/mac/objc_zombie.h" 5 #import "chrome/common/mac/objc_zombie.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <execinfo.h> 8 #include <execinfo.h>
9 #include <mach-o/dyld.h> 9 #include <mach-o/dyld.h>
10 #include <mach-o/nlist.h> 10 #include <mach-o/nlist.h>
11 11
12 #import <objc/objc-class.h> 12 #import <objc/objc-class.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 #include <iostream>
16 15
17 #include "base/debug/stack_trace.h" 16 #include "base/debug/stack_trace.h"
18 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
19 #include "base/logging.h" 18 #include "base/logging.h"
20 #include "base/mac/crash_logging.h" 19 #include "base/mac/crash_logging.h"
21 #include "base/mac/mac_util.h" 20 #include "base/mac/mac_util.h"
22 #include "base/metrics/histogram.h" 21 #include "base/metrics/histogram.h"
23 #include "base/synchronization/lock.h" 22 #include "base/synchronization/lock.h"
24 #import "chrome/common/mac/objc_method_swizzle.h" 23 #import "chrome/common/mac/objc_method_swizzle.h"
25 24
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 *record = g_zombies[i]; 245 *record = g_zombies[i];
247 return YES; 246 return YES;
248 } 247 }
249 } 248 }
250 return NO; 249 return NO;
251 } 250 }
252 251
253 // Dump the symbols. This is pulled out into a function to make it 252 // Dump the symbols. This is pulled out into a function to make it
254 // easy to use DCHECK to dump only in debug builds. 253 // easy to use DCHECK to dump only in debug builds.
255 BOOL DumpDeallocTrace(const void* const* array, int size) { 254 BOOL DumpDeallocTrace(const void* const* array, int size) {
256 // |cerr| because that's where PrintBacktrace() sends output. 255 fprintf(stderr, "Backtrace from -dealloc:\n");
257 std::cerr << "Backtrace from -dealloc:\n";
258 base::debug::StackTrace(array, size).PrintBacktrace(); 256 base::debug::StackTrace(array, size).PrintBacktrace();
259 257
260 return YES; 258 return YES;
261 } 259 }
262 260
263 // Log a message to a freed object. |wasa| is the object's original 261 // Log a message to a freed object. |wasa| is the object's original
264 // class. |aSelector| is the selector which the calling code was 262 // class. |aSelector| is the selector which the calling code was
265 // attempting to send. |viaSelector| is the selector of the 263 // attempting to send. |viaSelector| is the selector of the
266 // dispatch-related method which is being invoked to send |aSelector| 264 // dispatch-related method which is being invoked to send |aSelector|
267 // (for instance, -respondsToSelector:). 265 // (for instance, -respondsToSelector:).
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 if (oldZombies) { 544 if (oldZombies) {
547 for (size_t i = 0; i < oldCount; ++i) { 545 for (size_t i = 0; i < oldCount; ++i) {
548 if (oldZombies[i].object) 546 if (oldZombies[i].object)
549 object_dispose(oldZombies[i].object); 547 object_dispose(oldZombies[i].object);
550 } 548 }
551 free(oldZombies); 549 free(oldZombies);
552 } 550 }
553 } 551 }
554 552
555 } // namespace ObjcEvilDoers 553 } // namespace ObjcEvilDoers
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698