| OLD | NEW |
| 1 // Copyright (c) 2012, Google Inc. | 1 // Copyright (c) 2012, 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 return reinterpret_cast<uintptr_t>(entry[2]); | 242 return reinterpret_cast<uintptr_t>(entry[2]); |
| 243 } | 243 } |
| 244 void* PC(void** entry, int i) { | 244 void* PC(void** entry, int i) { |
| 245 return entry[3+i]; | 245 return entry[3+i]; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void PrintCountAndSize(MallocExtensionWriter* writer, | 248 void PrintCountAndSize(MallocExtensionWriter* writer, |
| 249 uintptr_t count, uintptr_t size) { | 249 uintptr_t count, uintptr_t size) { |
| 250 char buf[100]; | 250 char buf[100]; |
| 251 snprintf(buf, sizeof(buf), | 251 snprintf(buf, sizeof(buf), |
| 252 "%6"PRIu64": %8"PRIu64" [%6"PRIu64": %8"PRIu64"] @", | 252 "%6" PRIu64 ": %8" PRIu64 " [%6" PRIu64 ": %8" PRIu64 "] @", |
| 253 static_cast<uint64>(count), | 253 static_cast<uint64>(count), |
| 254 static_cast<uint64>(size), | 254 static_cast<uint64>(size), |
| 255 static_cast<uint64>(count), | 255 static_cast<uint64>(count), |
| 256 static_cast<uint64>(size)); | 256 static_cast<uint64>(size)); |
| 257 writer->append(buf, strlen(buf)); | 257 writer->append(buf, strlen(buf)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void PrintHeader(MallocExtensionWriter* writer, | 260 void PrintHeader(MallocExtensionWriter* writer, |
| 261 const char* label, void** entries) { | 261 const char* label, void** entries) { |
| 262 // Compute the total count and total size | 262 // Compute the total count and total size |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 C_SHIM(ReleaseToSystem, void, (size_t num_bytes), (num_bytes)); | 368 C_SHIM(ReleaseToSystem, void, (size_t num_bytes), (num_bytes)); |
| 369 C_SHIM(GetEstimatedAllocatedSize, size_t, (size_t size), (size)); | 369 C_SHIM(GetEstimatedAllocatedSize, size_t, (size_t size), (size)); |
| 370 C_SHIM(GetAllocatedSize, size_t, (const void* p), (p)); | 370 C_SHIM(GetAllocatedSize, size_t, (const void* p), (p)); |
| 371 | 371 |
| 372 // Can't use the shim here because of the need to translate the enums. | 372 // Can't use the shim here because of the need to translate the enums. |
| 373 extern "C" | 373 extern "C" |
| 374 MallocExtension_Ownership MallocExtension_GetOwnership(const void* p) { | 374 MallocExtension_Ownership MallocExtension_GetOwnership(const void* p) { |
| 375 return static_cast<MallocExtension_Ownership>( | 375 return static_cast<MallocExtension_Ownership>( |
| 376 MallocExtension::instance()->GetOwnership(p)); | 376 MallocExtension::instance()->GetOwnership(p)); |
| 377 } | 377 } |
| OLD | NEW |