Index: chrome/browser/chromeos/resource_reporter/resource_reporter.h |
diff --git a/chrome/browser/chromeos/resource_reporter/resource_reporter.h b/chrome/browser/chromeos/resource_reporter/resource_reporter.h |
index 405a2d799c89fe874ff55a8847b1ab9b06260d3a..f180a41faf8a6fb0a9d1b696cf5a3e8a8360252b 100644 |
--- a/chrome/browser/chromeos/resource_reporter/resource_reporter.h |
+++ b/chrome/browser/chromeos/resource_reporter/resource_reporter.h |
@@ -13,6 +13,7 @@ |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
+#include "base/memory/memory_coordinator_client.h" |
#include "base/memory/memory_pressure_listener.h" |
#include "base/memory/singleton.h" |
#include "chrome/browser/task_manager/task_manager_observer.h" |
@@ -26,7 +27,8 @@ namespace chromeos { |
// Chrome tasks and reports a weighted random sample of them via Rappor whenever |
// memory pressure is critical. The reporting is limited to once per |
// |kMinimumTimeBetweenReportsInMS|. |
-class ResourceReporter : public task_manager::TaskManagerObserver { |
+class ResourceReporter : public task_manager::TaskManagerObserver, |
+ public base::MemoryCoordinatorClient { |
public: |
// A collection of the data of a task manager's task that the ResourceReporter |
// is interested in. |
@@ -149,6 +151,9 @@ class ResourceReporter : public task_manager::TaskManagerObserver { |
// Gets the bucket in which the current system's number of CPU cores fall. |
static CpuCoresNumberRange GetCurrentSystemCpuCoresRange(); |
+ // base::MemoryCoordinatorClient: |
+ void OnMemoryStateChange(base::MemoryState state) override; |
+ |
// Perform a weighted random sampling to select a task by its CPU or memory |
// usage weights so that we can record samples for them via Rappor. |
// They return nullptr if no TaskRecord has been selected. |
@@ -162,6 +167,9 @@ class ResourceReporter : public task_manager::TaskManagerObserver { |
using MemoryPressureLevel = base::MemoryPressureListener::MemoryPressureLevel; |
void OnMemoryPressure(MemoryPressureLevel memory_pressure_level); |
+ void StartRecordingCurrentState(); |
+ void StopRecordingCurrentState(); |
+ |
// Monitor memory pressure events. |
std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; |