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

Side by Side Diff: base/debug/leak_annotations.h

Issue 6976044: Fix http://codereview.chromium.org/6869009 to ignore an existing object exactly once and land the... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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/allocator/allocator.gyp ('k') | base/metrics/histogram.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_DEBUG_LEAK_ANNOTATIONS_H_ 5 #ifndef BASE_DEBUG_LEAK_ANNOTATIONS_H_
6 #define BASE_DEBUG_LEAK_ANNOTATIONS_H_ 6 #define BASE_DEBUG_LEAK_ANNOTATIONS_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
11 #if defined(OS_LINUX) && defined(USE_HEAPCHECKER) 11 #if defined(OS_LINUX) && defined(USE_HEAPCHECKER)
12 12
13 #include "third_party/tcmalloc/chromium/src/google/heap-checker.h" 13 #include "third_party/tcmalloc/chromium/src/google/heap-checker.h"
14 14
15 // Annotate a program scope as having memory leaks. Tcmalloc's heap leak 15 // Annotate a program scope as having memory leaks. Tcmalloc's heap leak
16 // checker will ignore them. Note that these annotations may mask real bugs 16 // checker will ignore them. Note that these annotations may mask real bugs
17 // and should not be used in the production code. 17 // and should not be used in the production code.
18 #define ANNOTATE_SCOPED_MEMORY_LEAK \ 18 #define ANNOTATE_SCOPED_MEMORY_LEAK \
19 HeapLeakChecker::Disabler heap_leak_checker_disabler 19 HeapLeakChecker::Disabler heap_leak_checker_disabler
20 20
21 // Annotate an object pointer as referencing a leaky object. This object and all
22 // the heap objects referenced by it will be ignored by the heap checker.
23 //
24 // X should be referencing an active allocated object. If it is not, the
25 // annotation will be ignored.
26 // No object should be annotated with ANNOTATE_SCOPED_MEMORY_LEAK twice.
27 // Once an object is annotated with ANNOTATE_SCOPED_MEMORY_LEAK, it cannot be
28 // deleted.
29 #define ANNOTATE_LEAKING_OBJECT_PTR(X) \
30 HeapLeakChecker::IgnoreObject(X)
31
21 #else 32 #else
22 33
23 // If tcmalloc is not used, the annotations should be no-ops. 34 // If tcmalloc is not used, the annotations should be no-ops.
24 #define ANNOTATE_SCOPED_MEMORY_LEAK 35 #define ANNOTATE_SCOPED_MEMORY_LEAK
36 #define ANNOTATE_LEAKING_OBJECT_PTR(X)
25 37
26 #endif 38 #endif
27 39
28 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_ 40 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_
OLDNEW
« no previous file with comments | « base/allocator/allocator.gyp ('k') | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698