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

Side by Side Diff: base/leak_tracker.h

Issue 3527004: Revert 61142 - Made logging macros evaluate its stream arguments lazily.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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 | « base/base.gyp ('k') | base/logging.h » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef BASE_LEAK_TRACKER_H_ 5 #ifndef BASE_LEAK_TRACKER_H_
6 #define BASE_LEAK_TRACKER_H_ 6 #define BASE_LEAK_TRACKER_H_
7 #pragma once 7 #pragma once
8 8
9 // Only enable leak tracking in debug builds. 9 // Only enable leak tracking in debug builds.
10 #ifndef NDEBUG 10 #ifndef NDEBUG
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 for (LinkNode<LeakTracker<T> >* node = instances()->head(); 84 for (LinkNode<LeakTracker<T> >* node = instances()->head();
85 node != instances()->end(); 85 node != instances()->end();
86 node = node->next()) { 86 node = node->next()) {
87 StackTrace& allocation_stack = node->value()->allocation_stack_; 87 StackTrace& allocation_stack = node->value()->allocation_stack_;
88 88
89 if (count < kMaxStackTracesToCopyOntoStack) 89 if (count < kMaxStackTracesToCopyOntoStack)
90 stacktraces[count] = allocation_stack; 90 stacktraces[count] = allocation_stack;
91 91
92 ++count; 92 ++count;
93 LOG(ERROR) << "Leaked " << node << " which was allocated by:"; 93 LOG(ERROR) << "Leaked " << node << " which was allocated by:";
94 allocation_stack.OutputToStream(&LOG_STREAM(ERROR)); 94 allocation_stack.OutputToStream(&LOG(ERROR));
95 } 95 }
96 96
97 CHECK_EQ(0u, count); 97 CHECK_EQ(0u, count);
98 98
99 // Hack to keep |stacktraces| and |count| alive (so compiler 99 // Hack to keep |stacktraces| and |count| alive (so compiler
100 // doesn't optimize it out, and it will appear in mini-dumps). 100 // doesn't optimize it out, and it will appear in mini-dumps).
101 if (count == 0x1234) { 101 if (count == 0x1234) {
102 for (size_t i = 0; i < kMaxStackTracesToCopyOntoStack; ++i) 102 for (size_t i = 0; i < kMaxStackTracesToCopyOntoStack; ++i)
103 stacktraces[i].PrintBacktrace(); 103 stacktraces[i].PrintBacktrace();
104 } 104 }
(...skipping 18 matching lines...) Expand all
123 } 123 }
124 124
125 StackTrace allocation_stack_; 125 StackTrace allocation_stack_;
126 }; 126 };
127 127
128 #endif // ENABLE_LEAK_TRACKER 128 #endif // ENABLE_LEAK_TRACKER
129 129
130 } // namespace base 130 } // namespace base
131 131
132 #endif // BASE_LEAK_TRACKER_H_ 132 #endif // BASE_LEAK_TRACKER_H_
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | base/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698