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

Side by Side Diff: components/metrics/leak_detector/leak_detector.cc

Issue 1681263003: metrics: Add leak detector controller in Chrome OS metrics system (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new files Created 4 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/metrics/leak_detector/leak_detector.h"
6
7 #include <algorithm>
8
9 namespace metrics {
10
11 LeakDetector::LeakReport::LeakReport() {}
12
13 LeakDetector::LeakReport::~LeakReport() {}
14
15 LeakDetector::LeakDetector(float sampling_rate,
16 int max_stack_depth,
17 uint64_t analysis_interval_bytes,
18 int size_suspicion_threshold,
19 int call_stack_suspicion_threshold) {}
20
21 LeakDetector::~LeakDetector() {}
22
23 bool LeakDetector::AddObserver(Observer* observer) {
24 observers_.push_back(observer);
25 return true;
Alexei Svitkine (slow) 2016/02/10 20:16:58 If you always return true, why have a return value
Simon Que 2016/02/11 01:45:37 Changing them both to return void, esp in light of
26 }
27
28 bool LeakDetector::RemoveObserver(Observer* observer) {
29 auto iter = std::find(observers_.begin(), observers_.end(), observer);
30 if (iter == observers_.end())
31 return false;
32 observers_.erase(iter);
33 return true;
34 }
35
36 void LeakDetector::NotifyObservers(const std::vector<LeakReport>& reports) {
37 for (LeakDetector::Observer* observer : observers_) {
38 for (const LeakReport& report : reports) {
39 observer->OnLeakFound(report);
40 }
41 }
42 }
43
44 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698