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

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

Issue 16845006: Fix LeakSanitizer annotations for NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« 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) 2011 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 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 // This file defines macros which can be used to annotate intentional memory 10 // This file defines macros which can be used to annotate intentional memory
(...skipping 15 matching lines...) Expand all
26 defined(USE_HEAPCHECKER) 26 defined(USE_HEAPCHECKER)
27 27
28 #include "third_party/tcmalloc/chromium/src/gperftools/heap-checker.h" 28 #include "third_party/tcmalloc/chromium/src/gperftools/heap-checker.h"
29 29
30 #define ANNOTATE_SCOPED_MEMORY_LEAK \ 30 #define ANNOTATE_SCOPED_MEMORY_LEAK \
31 HeapLeakChecker::Disabler heap_leak_checker_disabler 31 HeapLeakChecker::Disabler heap_leak_checker_disabler
32 32
33 #define ANNOTATE_LEAKING_OBJECT_PTR(X) \ 33 #define ANNOTATE_LEAKING_OBJECT_PTR(X) \
34 HeapLeakChecker::IgnoreObject(X) 34 HeapLeakChecker::IgnoreObject(X)
35 35
36 #elif defined(LEAK_SANITIZER) 36 #elif defined(LEAK_SANITIZER) && !defined(OS_NACL)
37 37
38 extern "C" { 38 extern "C" {
39 void __lsan_disable(); 39 void __lsan_disable();
40 void __lsan_enable(); 40 void __lsan_enable();
41 void __lsan_ignore_object(const void *p); 41 void __lsan_ignore_object(const void *p);
42 } // extern "C" 42 } // extern "C"
43 43
44 class ScopedLeakSanitizerDisabler { 44 class ScopedLeakSanitizerDisabler {
45 public: 45 public:
46 ScopedLeakSanitizerDisabler() { __lsan_disable(); } 46 ScopedLeakSanitizerDisabler() { __lsan_disable(); }
47 ~ScopedLeakSanitizerDisabler() { __lsan_enable(); } 47 ~ScopedLeakSanitizerDisabler() { __lsan_enable(); }
48 private: 48 private:
49 DISALLOW_COPY_AND_ASSIGN(ScopedLeakSanitizerDisabler); 49 DISALLOW_COPY_AND_ASSIGN(ScopedLeakSanitizerDisabler);
50 }; 50 };
51 51
52 #define ANNOTATE_SCOPED_MEMORY_LEAK \ 52 #define ANNOTATE_SCOPED_MEMORY_LEAK \
53 ScopedLeakSanitizerDisabler leak_sanitizer_disabler 53 ScopedLeakSanitizerDisabler leak_sanitizer_disabler
54 54
55 #define ANNOTATE_LEAKING_OBJECT_PTR(X) __lsan_ignore_object(X); 55 #define ANNOTATE_LEAKING_OBJECT_PTR(X) __lsan_ignore_object(X);
56 56
57 #else 57 #else
58 58
59 // If neither HeapChecker nor LSan are used, the annotations should be no-ops. 59 // If neither HeapChecker nor LSan are used, the annotations should be no-ops.
60 #define ANNOTATE_SCOPED_MEMORY_LEAK ((void)0) 60 #define ANNOTATE_SCOPED_MEMORY_LEAK ((void)0)
61 #define ANNOTATE_LEAKING_OBJECT_PTR(X) ((void)0) 61 #define ANNOTATE_LEAKING_OBJECT_PTR(X) ((void)0)
62 62
63 #endif 63 #endif
64 64
65 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_ 65 #endif // BASE_DEBUG_LEAK_ANNOTATIONS_H_
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