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

Unified Diff: chrome/browser/metrics/leak_detector_controller.cc

Issue 1665553002: metrics: Connect leak detector to allocator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use leaky lazy instance instead of singleton; Use saturated_cast to compute sampling factor Created 4 years, 9 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: chrome/browser/metrics/leak_detector_controller.cc
diff --git a/chrome/browser/metrics/leak_detector_controller.cc b/chrome/browser/metrics/leak_detector_controller.cc
index 5403f2cc2975ba1038611cb6d48d1d60fd11076e..23337f8fa2b4bf4d22681c75416c89b95ff6c1ac 100644
--- a/chrome/browser/metrics/leak_detector_controller.cc
+++ b/chrome/browser/metrics/leak_detector_controller.cc
@@ -21,18 +21,16 @@ const int kCallStackSuspicionThreshold = 4;
} // namespace
-LeakDetectorController::LeakDetectorController()
- : detector_(kSamplingRate,
- kMaxStackDepth,
- kAnalysisIntervalBytes,
- kSizeSuspicionThreshold,
- kCallStackSuspicionThreshold) {
- detector_.AddObserver(this);
+LeakDetectorController::LeakDetectorController() {
+ LeakDetector* detector = LeakDetector::GetInstance();
+ detector->Init(kSamplingRate, kMaxStackDepth, kAnalysisIntervalBytes,
+ kSizeSuspicionThreshold, kCallStackSuspicionThreshold);
+ detector->AddObserver(this);
}
LeakDetectorController::~LeakDetectorController() {
DCHECK(thread_checker_.CalledOnValidThread());
- detector_.RemoveObserver(this);
+ LeakDetector::GetInstance()->RemoveObserver(this);
}
void LeakDetectorController::OnLeakFound(

Powered by Google App Engine
This is Rietveld 408576698