summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_details.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/memory_details.h')
-rw-r--r--chrome/browser/memory_details.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 568f591..bdf032f 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -107,6 +107,11 @@ class ProcessInfoSnapshot;
// }
class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
public:
+ enum UserMetricsMode {
+ UPDATE_USER_METRICS, // Update UMA memory histograms with results.
+ SKIP_USER_METRICS
+ };
+
// Constructor.
MemoryDetails();
@@ -116,10 +121,15 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// Initiate updating the current memory details. These are fetched
// asynchronously because data must be collected from multiple threads.
+ // Updates UMA memory histograms if |mode| is UPDATE_USER_METRICS.
// OnDetailsAvailable will be called when this process is complete.
- void StartFetch();
+ void StartFetch(UserMetricsMode user_metrics_mode);
- virtual void OnDetailsAvailable() {}
+ virtual void OnDetailsAvailable() = 0;
+
+ // Returns a string summarizing memory usage of the Chrome browser process
+ // and all sub-processes, suitable for logging.
+ std::string ToLogString();
protected:
friend class base::RefCountedThreadSafe<MemoryDetails>;
@@ -156,8 +166,7 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// renderer processes is only available there.
void CollectChildInfoOnUIThread();
- // Each time we take a memory sample, we do a little work to update
- // the global histograms for tracking memory usage.
+ // Updates the global histograms for tracking memory usage.
void UpdateHistograms();
// Returns a pointer to the ProcessData structure for Chrome.
@@ -165,6 +174,8 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
std::vector<ProcessData> process_data_;
+ UserMetricsMode user_metrics_mode_;
+
DISALLOW_COPY_AND_ASSIGN(MemoryDetails);
};