Commit 6c55ad9a authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Commit Bot

Remove MemoryCoordinatorClient from chrome/browser/chromeos.

BUG=888904

Change-Id: I82f7cc310b32a18df79dd46756d685aee03f0276
Reviewed-on: https://chromium-review.googlesource.com/c/1272935Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#599569}
parent b671af6d
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/memory_coordinator_client_registry.h"
#include "base/memory/memory_pressure_monitor.h" #include "base/memory/memory_pressure_monitor.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/rand_util.h" #include "base/rand_util.h"
...@@ -114,7 +113,6 @@ void ResourceReporter::StartMonitoring( ...@@ -114,7 +113,6 @@ void ResourceReporter::StartMonitoring(
is_monitoring_ = true; is_monitoring_ = true;
memory_pressure_listener_.reset(new base::MemoryPressureListener( memory_pressure_listener_.reset(new base::MemoryPressureListener(
base::Bind(&ResourceReporter::OnMemoryPressure, base::Unretained(this)))); base::Bind(&ResourceReporter::OnMemoryPressure, base::Unretained(this))));
base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this);
} }
void ResourceReporter::StopMonitoring() { void ResourceReporter::StopMonitoring() {
...@@ -131,8 +129,6 @@ void ResourceReporter::StopMonitoring() { ...@@ -131,8 +129,6 @@ void ResourceReporter::StopMonitoring() {
is_monitoring_ = false; is_monitoring_ = false;
memory_pressure_listener_.reset(); memory_pressure_listener_.reset();
base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this);
} }
void ResourceReporter::OnTasksRefreshedWithBackgroundCalculations( void ResourceReporter::OnTasksRefreshedWithBackgroundCalculations(
...@@ -434,20 +430,4 @@ void ResourceReporter::StopRecordingCurrentState() { ...@@ -434,20 +430,4 @@ void ResourceReporter::StopRecordingCurrentState() {
observed_task_manager()->RemoveObserver(this); observed_task_manager()->RemoveObserver(this);
} }
void ResourceReporter::OnMemoryStateChange(base::MemoryState state) {
switch (state) {
case base::MemoryState::NORMAL:
StopRecordingCurrentState();
break;
case base::MemoryState::THROTTLED:
StartRecordingCurrentState();
break;
case base::MemoryState::SUSPENDED:
// Note: Not supported at present. Fall through.
case base::MemoryState::UNKNOWN:
NOTREACHED();
break;
}
}
} // namespace chromeos } // namespace chromeos
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/memory_coordinator_client.h"
#include "base/memory/memory_pressure_listener.h" #include "base/memory/memory_pressure_listener.h"
#include "base/memory/singleton.h" #include "base/memory/singleton.h"
#include "chrome/browser/task_manager/task_manager_observer.h" #include "chrome/browser/task_manager/task_manager_observer.h"
...@@ -28,8 +27,7 @@ namespace chromeos { ...@@ -28,8 +27,7 @@ namespace chromeos {
// Chrome tasks and reports a weighted random sample of them via Rappor whenever // Chrome tasks and reports a weighted random sample of them via Rappor whenever
// memory pressure is critical. The reporting is limited to once per // memory pressure is critical. The reporting is limited to once per
// |kMinimumTimeBetweenReportsInMS|. // |kMinimumTimeBetweenReportsInMS|.
class ResourceReporter : public task_manager::TaskManagerObserver, class ResourceReporter : public task_manager::TaskManagerObserver {
public base::MemoryCoordinatorClient {
public: public:
// A collection of the data of a task manager's task that the ResourceReporter // A collection of the data of a task manager's task that the ResourceReporter
// is interested in. // is interested in.
...@@ -152,9 +150,6 @@ class ResourceReporter : public task_manager::TaskManagerObserver, ...@@ -152,9 +150,6 @@ class ResourceReporter : public task_manager::TaskManagerObserver,
// Gets the bucket in which the current system's number of CPU cores fall. // Gets the bucket in which the current system's number of CPU cores fall.
static CpuCoresNumberRange GetCurrentSystemCpuCoresRange(); 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 // 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. // usage weights so that we can record samples for them via Rappor.
// They return nullptr if no TaskRecord has been selected. // They return nullptr if no TaskRecord has been selected.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment