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

Unified Diff: chrome/browser/metrics/metrics_memory_details.h

Issue 2396743002: Leak reports collect information about the memory usage (Closed)
Patch Set: Added setter for |generate_histograms_| Created 4 years, 2 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/metrics_memory_details.h
diff --git a/chrome/browser/metrics/metrics_memory_details.h b/chrome/browser/metrics/metrics_memory_details.h
index 23badc568a1f8d6f14330561a6ec994221f7503a..f833afbc82abfd528572eab33b22fb2c3598dbef 100644
--- a/chrome/browser/metrics/metrics_memory_details.h
+++ b/chrome/browser/metrics/metrics_memory_details.h
@@ -17,7 +17,7 @@
class MemoryGrowthTracker {
public:
MemoryGrowthTracker();
- ~MemoryGrowthTracker();
+ virtual ~MemoryGrowthTracker();
// If 30 minutes have passed since last UMA record, UpdateSample() computes
// a difference between current memory usage |sample| of process |pid| and
@@ -27,7 +27,7 @@ class MemoryGrowthTracker {
// If no memory usage of |pid| has not been recorded so far or 30 minutes
// have not passed since last record, it just returns false.
// |sample| is memory usage in kB.
- bool UpdateSample(base::ProcessId pid, int sample, int* diff);
+ virtual bool UpdateSample(base::ProcessId pid, int sample, int* diff);
private:
// Latest metrics about record time and memory usage at that time per process.
@@ -46,6 +46,10 @@ class MetricsMemoryDetails : public MemoryDetails {
MetricsMemoryDetails(const base::Closure& callback,
MemoryGrowthTracker* memory_growth_tracker);
+ void set_generate_histograms(bool generate_histograms) {
+ generate_histograms_ = generate_histograms;
+ }
+
protected:
~MetricsMemoryDetails() override;
@@ -60,6 +64,10 @@ class MetricsMemoryDetails : public MemoryDetails {
void UpdateSwapHistograms();
#endif
+ // Notifies |memory_growth_tracker_| about the memory usage.
+ // Update histograms on memory growth or shrink in renderer processes.
+ void AnalyzeMemoryGrowth();
+
base::Closure callback_;
// A pointer to MemoryGrowthTracker which is contained in a longer-lived
@@ -67,6 +75,10 @@ class MetricsMemoryDetails : public MemoryDetails {
// If it is null, nothing is tracked.
MemoryGrowthTracker* memory_growth_tracker_;
+ // A flag indicating if histogram data should be generated. True on default.
+ // If false, then only MemoryGrowthTracker gets notified about memory usage.
+ bool generate_histograms_;
+
DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetails);
};

Powered by Google App Engine
This is Rietveld 408576698