| OLD | NEW |
| 1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 private: | 178 private: |
| 179 Disabler(const Disabler&); // disallow copy | 179 Disabler(const Disabler&); // disallow copy |
| 180 void operator=(const Disabler&); // and assign | 180 void operator=(const Disabler&); // and assign |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 // Ignore an object located at 'ptr' (can go at the start or into the object) | 183 // Ignore an object located at 'ptr' (can go at the start or into the object) |
| 184 // as well as all heap objects (transitively) referenced from it | 184 // as well as all heap objects (transitively) referenced from it |
| 185 // for the purposes of heap leak checking. | 185 // for the purposes of heap leak checking. |
| 186 // If 'ptr' does not point to an active allocated object | 186 // If 'ptr' does not point to an active allocated object |
| 187 // at the time of this call, it is ignored; | 187 // at the time of this call, it is ignored; |
| 188 // but if it does, the object must not get deleted from the heap later on; | 188 // but if it does, the object must not get deleted from the heap later on. |
| 189 // it must also be not already ignored at the time of this call. | |
| 190 // | 189 // |
| 191 // See also HiddenPointer, below, if you need to prevent a pointer from | 190 // See also HiddenPointer, below, if you need to prevent a pointer from |
| 192 // being traversed by the heap checker but do not wish to transitively | 191 // being traversed by the heap checker but do not wish to transitively |
| 193 // whitelist objects referenced through it. | 192 // whitelist objects referenced through it. |
| 194 static void IgnoreObject(const void* ptr); | 193 static void IgnoreObject(const void* ptr); |
| 195 | 194 |
| 196 // Undo what an earlier IgnoreObject() call promised and asked to do. | 195 // Undo what an earlier IgnoreObject() call promised and asked to do. |
| 197 // At the time of this call 'ptr' must point at or inside of an active | 196 // At the time of this call 'ptr' must point at or inside of an active |
| 198 // allocated object which was previously registered with IgnoreObject(). | 197 // allocated object which was previously registered with IgnoreObject(). |
| 199 static void UnIgnoreObject(const void* ptr); | 198 static void UnIgnoreObject(const void* ptr); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // (they run only if we are doing heap leak checking.) | 408 // (they run only if we are doing heap leak checking.) |
| 410 // 'body' should be the cleanup code to run. 'name' doesn't matter, | 409 // 'body' should be the cleanup code to run. 'name' doesn't matter, |
| 411 // but must be unique amongst all REGISTER_HEAPCHECK_CLEANUP calls. | 410 // but must be unique amongst all REGISTER_HEAPCHECK_CLEANUP calls. |
| 412 #define REGISTER_HEAPCHECK_CLEANUP(name, body) \ | 411 #define REGISTER_HEAPCHECK_CLEANUP(name, body) \ |
| 413 namespace { \ | 412 namespace { \ |
| 414 void heapcheck_cleanup_##name() { body; } \ | 413 void heapcheck_cleanup_##name() { body; } \ |
| 415 static HeapCleaner heapcheck_cleaner_##name(&heapcheck_cleanup_##name); \ | 414 static HeapCleaner heapcheck_cleaner_##name(&heapcheck_cleanup_##name); \ |
| 416 } | 415 } |
| 417 | 416 |
| 418 #endif // BASE_HEAP_CHECKER_H_ | 417 #endif // BASE_HEAP_CHECKER_H_ |
| OLD | NEW |