OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 // "Ignorance" means that LSan's reachability traversal is stopped short | 70 // "Ignorance" means that LSan's reachability traversal is stopped short |
71 // upon encountering an ignored memory chunk. Consequently, LSan will not | 71 // upon encountering an ignored memory chunk. Consequently, LSan will not |
72 // scan an ignored memory chunk for live, reachable pointers. However, should | 72 // scan an ignored memory chunk for live, reachable pointers. However, should |
73 // those embedded pointers be reachable by some other path, they will be | 73 // those embedded pointers be reachable by some other path, they will be |
74 // reported as leaking. | 74 // reported as leaking. |
75 #define LEAK_SANITIZER_IGNORE_OBJECT(X) __lsan_ignore_object(X) | 75 #define LEAK_SANITIZER_IGNORE_OBJECT(X) __lsan_ignore_object(X) |
76 | 76 |
77 // If the object pointed to by the static local is on the Oilpan heap, a strong | 77 // If the object pointed to by the static local is on the Oilpan heap, a strong |
78 // Persistent<> is created to keep the pointed-to heap object alive. This makes | 78 // Persistent<> is created to keep the pointed-to heap object alive. This makes |
79 // both the Persistent<> and the heap object _reachable_ by LeakSanitizer's leak | 79 // both the Persistent<> and the heap object _reachable_ by LeakSanitizer's leak |
80 // detection pass. We do not want these intentional leaks to be reported by LSan , | 80 // detection pass. We do not want these intentional leaks to be reported by |
81 // LSan, | |
dcheng
2016/10/01 19:58:17
Merge next lines as approrpiate.
Nico
2016/10/02 00:49:28
whoops, done.
| |
81 // hence the static local is registered with Oilpan | 82 // hence the static local is registered with Oilpan |
82 // (see RegisterStaticLocalReference<> below.) | 83 // (see RegisterStaticLocalReference<> below.) |
83 // | 84 // |
84 // Upon Blink shutdown, all the registered statics are released and a final roun d | 85 // Upon Blink shutdown, all the registered statics are released and a final |
85 // of GCs are performed to sweep out their now-unreachable object graphs. The en d | 86 // round of GCs are performed to sweep out their now-unreachable object graphs. |
86 // result being a tidied heap that the LeakSanitizer can then scan to report rea l leaks. | 87 // The end result being a tidied heap that the LeakSanitizer can then scan to |
88 // report real leaks. | |
87 // | 89 // |
88 // The CanRegisterStaticLocalReference<> and RegisterStaticLocalReference<> temp lates | 90 // The CanRegisterStaticLocalReference<> and RegisterStaticLocalReference<> |
89 // arrange for this -- for a class type T, a registerStatic() implementation is | 91 // templates arrange for this -- for a class type T, a registerStatic() |
90 // provided if "T* T::registerAsStaticReference(T*)" is a method on T | 92 // implementation is provided if "T* T::registerAsStaticReference(T*)" is a |
91 // (inherited or otherwise.) | 93 // method on T (inherited or otherwise.) |
92 // | 94 // |
93 // An empty, trivial registerStatic() method is provided for all other class typ es T. | 95 // An empty, trivial registerStatic() method is provided for all other class |
96 // types T. | |
94 template <typename T> | 97 template <typename T> |
95 class CanRegisterStaticLocalReference { | 98 class CanRegisterStaticLocalReference { |
96 typedef char YesType; | 99 typedef char YesType; |
97 typedef struct NoType { char padding[8]; } NoType; | 100 typedef struct NoType { char padding[8]; } NoType; |
98 | 101 |
99 // Check if class T has public method "T* registerAsStaticReference()". | 102 // Check if class T has public method "T* registerAsStaticReference()". |
100 template <typename V> | 103 template <typename V> |
101 static YesType checkHasRegisterAsStaticReferenceMethod( | 104 static YesType checkHasRegisterAsStaticReferenceMethod( |
102 V* p, | 105 V* p, |
103 typename std::enable_if<IsSubclass< | 106 typename std::enable_if<IsSubclass< |
(...skipping 27 matching lines...) Expand all Loading... | |
131 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object) | 134 WTF::RegisterStaticLocalReference<Type>::registerStatic(Object) |
132 #else | 135 #else |
133 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE | 136 #define WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE |
134 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0) | 137 #define LEAK_SANITIZER_IGNORE_OBJECT(X) ((void)0) |
135 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object | 138 #define LEAK_SANITIZER_REGISTER_STATIC_LOCAL(Type, Object) Object |
136 #endif // USE(LEAK_SANITIZER) | 139 #endif // USE(LEAK_SANITIZER) |
137 | 140 |
138 } // namespace WTF | 141 } // namespace WTF |
139 | 142 |
140 #endif // WTF_LeakAnnotations_h | 143 #endif // WTF_LeakAnnotations_h |
OLD | NEW |