Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: base/allocator/allocator_extension.cc

Issue 10823205: Report memory retained by memory allocator internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing DCHECK. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/allocator/allocator_extension_thunks.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/allocator/allocator_extension.h" 5 #include "base/allocator/allocator_extension.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace base { 9 namespace base {
10 namespace allocator { 10 namespace allocator {
11 11
12 bool GetProperty(const char* name, size_t* value) { 12 bool GetAllocatorWasteSize(size_t* size) {
13 thunks::GetPropertyFunction get_property_function = 13 thunks::GetAllocatorWasteSizeFunction get_allocator_waste_size_function =
14 base::allocator::thunks::GetGetPropertyFunction(); 14 thunks::GetGetAllocatorWasteSizeFunction();
15 return get_property_function != NULL && get_property_function(name, value); 15 return get_allocator_waste_size_function != NULL &&
16 get_allocator_waste_size_function(size);
16 } 17 }
17 18
18 void GetStats(char* buffer, int buffer_length) { 19 void GetStats(char* buffer, int buffer_length) {
19 DCHECK_GT(buffer_length, 0); 20 DCHECK_GT(buffer_length, 0);
20 thunks::GetStatsFunction get_stats_function = 21 thunks::GetStatsFunction get_stats_function = thunks::GetGetStatsFunction();
21 base::allocator::thunks::GetGetStatsFunction();
22 if (get_stats_function) 22 if (get_stats_function)
23 get_stats_function(buffer, buffer_length); 23 get_stats_function(buffer, buffer_length);
24 else 24 else
25 buffer[0] = '\0'; 25 buffer[0] = '\0';
26 } 26 }
27 27
28 void ReleaseFreeMemory() { 28 void ReleaseFreeMemory() {
29 thunks::ReleaseFreeMemoryFunction release_free_memory_function = 29 thunks::ReleaseFreeMemoryFunction release_free_memory_function =
30 base::allocator::thunks::GetReleaseFreeMemoryFunction(); 30 thunks::GetReleaseFreeMemoryFunction();
31 if (release_free_memory_function) 31 if (release_free_memory_function)
32 release_free_memory_function(); 32 release_free_memory_function();
33 } 33 }
34 34
35 void SetGetPropertyFunction( 35 void SetGetAllocatorWasteSizeFunction(
36 thunks::GetPropertyFunction get_property_function) { 36 thunks::GetAllocatorWasteSizeFunction get_allocator_waste_size_function) {
37 DCHECK_EQ(base::allocator::thunks::GetGetPropertyFunction(), 37 DCHECK_EQ(thunks::GetGetAllocatorWasteSizeFunction(),
38 reinterpret_cast<thunks::GetPropertyFunction>(NULL)); 38 reinterpret_cast<thunks::GetAllocatorWasteSizeFunction>(NULL));
39 base::allocator::thunks::SetGetPropertyFunction(get_property_function); 39 thunks::SetGetAllocatorWasteSizeFunction(get_allocator_waste_size_function);
40 } 40 }
41 41
42 void SetGetStatsFunction(thunks::GetStatsFunction get_stats_function) { 42 void SetGetStatsFunction(thunks::GetStatsFunction get_stats_function) {
43 DCHECK_EQ(base::allocator::thunks::GetGetStatsFunction(), 43 DCHECK_EQ(thunks::GetGetStatsFunction(),
44 reinterpret_cast<thunks::GetStatsFunction>(NULL)); 44 reinterpret_cast<thunks::GetStatsFunction>(NULL));
45 base::allocator::thunks::SetGetStatsFunction(get_stats_function); 45 thunks::SetGetStatsFunction(get_stats_function);
46 } 46 }
47 47
48 void SetReleaseFreeMemoryFunction( 48 void SetReleaseFreeMemoryFunction(
49 thunks::ReleaseFreeMemoryFunction release_free_memory_function) { 49 thunks::ReleaseFreeMemoryFunction release_free_memory_function) {
50 DCHECK_EQ(base::allocator::thunks::GetReleaseFreeMemoryFunction(), 50 DCHECK_EQ(thunks::GetReleaseFreeMemoryFunction(),
51 reinterpret_cast<thunks::ReleaseFreeMemoryFunction>(NULL)); 51 reinterpret_cast<thunks::ReleaseFreeMemoryFunction>(NULL));
52 base::allocator::thunks::SetReleaseFreeMemoryFunction( 52 thunks::SetReleaseFreeMemoryFunction(release_free_memory_function);
53 release_free_memory_function);
54 } 53 }
55 54
56 } // namespace allocator 55 } // namespace allocator
57 } // namespace base 56 } // namespace base
OLDNEW
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/allocator/allocator_extension_thunks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698