| OLD | NEW |
| 1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 // Bucket hash table. | 319 // Bucket hash table. |
| 320 // We hand-craft one instead of using one of the pre-written | 320 // We hand-craft one instead of using one of the pre-written |
| 321 // ones because we do not want to use malloc when operating on the table. | 321 // ones because we do not want to use malloc when operating on the table. |
| 322 // It is only few lines of code, so no big deal. | 322 // It is only few lines of code, so no big deal. |
| 323 Bucket** table_; | 323 Bucket** table_; |
| 324 int num_buckets_; | 324 int num_buckets_; |
| 325 | 325 |
| 326 // Map of all currently allocated objects we know about. | 326 // Map of all currently allocated objects we know about. |
| 327 AllocationMap* allocation_; | 327 AllocationMap* allocation_; |
| 328 | 328 |
| 329 DISALLOW_COPY_AND_ASSIGN(HeapProfileTable); | 329 DISALLOW_EVIL_CONSTRUCTORS(HeapProfileTable); |
| 330 }; | 330 }; |
| 331 | 331 |
| 332 class HeapProfileTable::Snapshot { | 332 class HeapProfileTable::Snapshot { |
| 333 public: | 333 public: |
| 334 const Stats& total() const { return total_; } | 334 const Stats& total() const { return total_; } |
| 335 | 335 |
| 336 // Report anything in this snapshot as a leak. | 336 // Report anything in this snapshot as a leak. |
| 337 // May use new/delete for temporary storage. | 337 // May use new/delete for temporary storage. |
| 338 // If should_symbolize is true, will fork (which is not threadsafe) | 338 // If should_symbolize is true, will fork (which is not threadsafe) |
| 339 // to turn addresses into symbol names. Set to false for maximum safety. | 339 // to turn addresses into symbol names. Set to false for maximum safety. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // Helpers for sorting and generating leak reports | 375 // Helpers for sorting and generating leak reports |
| 376 struct Entry; | 376 struct Entry; |
| 377 struct ReportState; | 377 struct ReportState; |
| 378 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); | 378 static void ReportCallback(const void* ptr, AllocValue* v, ReportState*); |
| 379 static void ReportObject(const void* ptr, AllocValue* v, char*); | 379 static void ReportObject(const void* ptr, AllocValue* v, char*); |
| 380 | 380 |
| 381 DISALLOW_COPY_AND_ASSIGN(Snapshot); | 381 DISALLOW_COPY_AND_ASSIGN(Snapshot); |
| 382 }; | 382 }; |
| 383 | 383 |
| 384 #endif // BASE_HEAP_PROFILE_TABLE_H_ | 384 #endif // BASE_HEAP_PROFILE_TABLE_H_ |
| OLD | NEW |