| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Returns true when the lock is held by this thread (for use in RAW_CHECK-s). | 111 // Returns true when the lock is held by this thread (for use in RAW_CHECK-s). |
| 112 static bool LockIsHeld(); | 112 static bool LockIsHeld(); |
| 113 | 113 |
| 114 // Locker object that acquires the MemoryRegionMap::Lock | 114 // Locker object that acquires the MemoryRegionMap::Lock |
| 115 // for the duration of its lifetime (a C++ scope). | 115 // for the duration of its lifetime (a C++ scope). |
| 116 class LockHolder { | 116 class LockHolder { |
| 117 public: | 117 public: |
| 118 LockHolder() { Lock(); } | 118 LockHolder() { Lock(); } |
| 119 ~LockHolder() { Unlock(); } | 119 ~LockHolder() { Unlock(); } |
| 120 private: | 120 private: |
| 121 DISALLOW_COPY_AND_ASSIGN(LockHolder); | 121 DISALLOW_EVIL_CONSTRUCTORS(LockHolder); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 // A memory region that we know about through malloc_hook-s. | 124 // A memory region that we know about through malloc_hook-s. |
| 125 // This is essentially an interface through which MemoryRegionMap | 125 // This is essentially an interface through which MemoryRegionMap |
| 126 // exports the collected data to its clients. Thread-compatible. | 126 // exports the collected data to its clients. Thread-compatible. |
| 127 struct Region { | 127 struct Region { |
| 128 uintptr_t start_addr; // region start address | 128 uintptr_t start_addr; // region start address |
| 129 uintptr_t end_addr; // region end address | 129 uintptr_t end_addr; // region end address |
| 130 int call_stack_depth; // number of caller stack frames that we saved | 130 int call_stack_depth; // number of caller stack frames that we saved |
| 131 const void* call_stack[kMaxStackDepth]; // caller address stack array | 131 const void* call_stack[kMaxStackDepth]; // caller address stack array |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 static void MunmapHook(const void* ptr, size_t size); | 322 static void MunmapHook(const void* ptr, size_t size); |
| 323 static void MremapHook(const void* result, const void* old_addr, | 323 static void MremapHook(const void* result, const void* old_addr, |
| 324 size_t old_size, size_t new_size, int flags, | 324 size_t old_size, size_t new_size, int flags, |
| 325 const void* new_addr); | 325 const void* new_addr); |
| 326 static void SbrkHook(const void* result, ptrdiff_t increment); | 326 static void SbrkHook(const void* result, ptrdiff_t increment); |
| 327 | 327 |
| 328 // Log all memory regions; Useful for debugging only. | 328 // Log all memory regions; Useful for debugging only. |
| 329 // Assumes Lock() is held | 329 // Assumes Lock() is held |
| 330 static void LogAllLocked(); | 330 static void LogAllLocked(); |
| 331 | 331 |
| 332 DISALLOW_COPY_AND_ASSIGN(MemoryRegionMap); | 332 DISALLOW_EVIL_CONSTRUCTORS(MemoryRegionMap); |
| 333 }; | 333 }; |
| 334 | 334 |
| 335 #endif // BASE_MEMORY_REGION_MAP_H_ | 335 #endif // BASE_MEMORY_REGION_MAP_H_ |
| OLD | NEW |