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

Unified Diff: third_party/tcmalloc/chromium/src/gperftools/allocated_type_map.h

Issue 10411047: Type profiler by intercepting 'new' and 'delete' expressions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove some comments Created 8 years, 5 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: third_party/tcmalloc/chromium/src/gperftools/allocated_type_map.h
diff --git a/third_party/tcmalloc/chromium/src/gperftools/allocated_type_map.h b/third_party/tcmalloc/chromium/src/gperftools/allocated_type_map.h
new file mode 100644
index 0000000000000000000000000000000000000000..0ea7c1f0903338b118d6cb2a36e638f7ec527f34
--- /dev/null
+++ b/third_party/tcmalloc/chromium/src/gperftools/allocated_type_map.h
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATED_TYPE_MAP_H_
Alexander Potapenko 2012/08/03 09:57:07 The include guard should probably have a different
Dai Mikurube (NOT FULLTIME) 2012/08/07 10:39:18 tcmalloc, malloc_hook and stacktrace have a differ
+#define BASE_ALLOCATED_TYPE_MAP_H_
+
+#include <typeinfo>
+
+#ifndef PERFTOOLS_DLL_DECL
Alexander Potapenko 2012/08/02 14:57:12 Isn't PERFTOOLS_DLL_DECL declared somewhere alread
Dai Mikurube (NOT FULLTIME) 2012/08/02 16:14:35 Ah, right. We may want to remote it. I'll consid
Dai Mikurube (NOT FULLTIME) 2012/08/03 10:01:50 Removed.
+# ifdef _WIN32
+# define PERFTOOLS_DLL_DECL __declspec(dllimport)
+# else
+# define PERFTOOLS_DLL_DECL
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct AllocatedObject {
Alexander Potapenko 2012/08/03 09:57:07 Use the specified order of declarations within a c
Dai Mikurube (NOT FULLTIME) 2012/08/07 10:39:18 Done: added "public:" and re-ordered constructors
+ unsigned int size;
+ const std::type_info* type;
+
+ AllocatedObject(): size(0), type(NULL) {}
+ AllocatedObject(unsigned int a, const std::type_info* b): size(a), type(b) {}
+};
+
+PERFTOOLS_DLL_DECL void InsertAllocatedType(
+ void* address, unsigned int size, const std::type_info& type);
jar (doing other things) 2012/08/02 23:38:30 nit: one arg per line. Indent matching paren.
Dai Mikurube (NOT FULLTIME) 2012/08/03 10:01:50 Done.
+
+PERFTOOLS_DLL_DECL void EraseAllocatedType(void* address);
+
+PERFTOOLS_DLL_DECL const std::type_info* LookupAllocatedType(
+ const void* address);
+
+PERFTOOLS_DLL_DECL void IterateAllocatedType(
+ void (*callback)(const void*, AllocatedObject*, void*), void* arg);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* BASE_ALLOCATED_TYPE_MAP_H_ */

Powered by Google App Engine
This is Rietveld 408576698