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

Unified Diff: base/allocator/allocator_extension.cc

Issue 10825250: Expose memory allocator internal stats and properties. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: base/allocator/allocator_extension.cc
diff --git a/base/allocator/allocator_extension.cc b/base/allocator/allocator_extension.cc
index 7ae11da3e301121f328b265dac2bf489d3c5b52e..d19f51d78fc03ee55e967ae3ebd3a620ef8ace12 100644
--- a/base/allocator/allocator_extension.cc
+++ b/base/allocator/allocator_extension.cc
@@ -9,6 +9,14 @@
namespace base {
namespace allocator {
+bool GetProperty(const char* name, size_t* value) {
+ if (thunks::GetPropertyFunction* get_property_function =
+ base::allocator::thunks::GetGetPropertyFunction())
jar (doing other things) 2012/08/11 03:39:46 nit: No reason to put a declaration in an if.... s
alexeif 2012/08/11 11:19:55 I don't like assignments inside 'if' either. I jus
+ return get_property_function(name, value);
+ else
jar (doing other things) 2012/08/11 03:39:46 nit: no need for else... as you're returning.
alexeif 2012/08/11 11:19:55 Done.
+ return false;
+}
+
void GetStats(char* buffer, int buffer_length) {
DCHECK_GT(buffer_length, 0);
if (thunks::GetStatsFunction* get_stats_function =
@@ -24,6 +32,13 @@ void ReleaseFreeMemory() {
release_free_memory_function();
}
+void SetGetPropertyFunction(
+ thunks::GetPropertyFunction* get_property_function) {
+ DCHECK_EQ(base::allocator::thunks::GetGetPropertyFunction(),
+ reinterpret_cast<thunks::GetPropertyFunction*>(NULL));
+ base::allocator::thunks::SetGetPropertyFunction(get_property_function);
+}
+
void SetGetStatsFunction(thunks::GetStatsFunction* get_stats_function) {
DCHECK_EQ(base::allocator::thunks::GetGetStatsFunction(),
reinterpret_cast<thunks::GetStatsFunction*>(NULL));

Powered by Google App Engine
This is Rietveld 408576698