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

Unified Diff: components/metrics/leak_detector/custom_allocator.h

Issue 1472693002: Revert of components/metrics: Add runtime memory leak detector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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: components/metrics/leak_detector/custom_allocator.h
diff --git a/components/metrics/leak_detector/custom_allocator.h b/components/metrics/leak_detector/custom_allocator.h
deleted file mode 100644
index fdbfc779b9f26f47d587d41c27bea15584c203e4..0000000000000000000000000000000000000000
--- a/components/metrics/leak_detector/custom_allocator.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2015 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 COMPONENTS_METRICS_LEAK_DETECTOR_CUSTOM_ALLOCATOR_H_
-#define COMPONENTS_METRICS_LEAK_DETECTOR_CUSTOM_ALLOCATOR_H_
-
-#include <stddef.h>
-
-#include <type_traits>
-
-namespace metrics {
-namespace leak_detector {
-
-// Custom allocator class to be passed to STLAllocator as a template argument.
-//
-// By default, CustomAllocator uses the default allocator (new/delete), but the
-// caller of Initialize ()can provide a pair of alternative alloc/ free
-// functions to use as an external allocator.
-//
-// This is a stateless class, but there is static data within the module that
-// needs to be created and deleted.
-//
-// Not thread-safe.
-class CustomAllocator {
- public:
- using AllocFunc = std::add_pointer<void*(size_t)>::type;
- using FreeFunc = std::add_pointer<void(void*, size_t)>::type;
-
- // Initialize CustomAllocator to use the default allocator.
- static void Initialize();
-
- // Initialize CustomAllocator to use the given alloc/free functions.
- static void Initialize(AllocFunc alloc_func, FreeFunc free_func);
-
- // Performs any cleanup required, e.g. unset custom functions. Returns true
- // on success or false if something failed.
- static bool Shutdown();
-
- static bool IsInitialized();
-
- // These functions must match the specifications in STLAllocator.
- static void* Allocate(size_t size);
- static void Free(void* ptr, size_t size);
-};
-
-} // namespace leak_detector
-} // namespace metrics
-
-#endif // COMPONENTS_METRICS_LEAK_DETECTOR_CUSTOM_ALLOCATOR_H_
« no previous file with comments | « components/metrics/leak_detector/call_stack_table_unittest.cc ('k') | components/metrics/leak_detector/custom_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698