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

Unified Diff: content/browser/memory/memory_coordinator.cc

Issue 2480203002: ui: Cleanup class/struct forward declarations (Closed)
Patch Set: Sync CL to position 430550 Created 4 years, 1 month 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
« no previous file with comments | « content/browser/memory/memory_coordinator.h ('k') | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator.cc
diff --git a/content/browser/memory/memory_coordinator.cc b/content/browser/memory/memory_coordinator.cc
index 517aaedc34a1a13f696d9e0532c5c4c9117458a1..1c6df06eb8f4e59061aa3a55795b583839175e46 100644
--- a/content/browser/memory/memory_coordinator.cc
+++ b/content/browser/memory/memory_coordinator.cc
@@ -5,6 +5,7 @@
#include "content/browser/memory/memory_coordinator.h"
#include "base/memory/memory_coordinator_client_registry.h"
+#include "base/metrics/histogram_macros.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_client.h"
@@ -77,8 +78,8 @@ size_t MemoryCoordinator::NumChildrenForTesting() {
return children_.size();
}
-bool MemoryCoordinator::SetMemoryState(int render_process_id,
- mojom::MemoryState memory_state) {
+bool MemoryCoordinator::SetChildMemoryState(int render_process_id,
+ mojom::MemoryState memory_state) {
// Can't set an invalid memory state.
if (memory_state == mojom::MemoryState::UNKNOWN)
return false;
@@ -112,7 +113,7 @@ bool MemoryCoordinator::SetMemoryState(int render_process_id,
return true;
}
-mojom::MemoryState MemoryCoordinator::GetMemoryState(
+mojom::MemoryState MemoryCoordinator::GetChildMemoryState(
int render_process_id) const {
auto iter = children_.find(render_process_id);
if (iter == children_.end())
@@ -120,6 +121,25 @@ mojom::MemoryState MemoryCoordinator::GetMemoryState(
return iter->second.memory_state;
}
+void MemoryCoordinator::RecordMemoryPressure(
+ base::MemoryPressureMonitor::MemoryPressureLevel level) {
+ int state = static_cast<int>(GetCurrentMemoryState());
+ switch (level) {
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE:
+ UMA_HISTOGRAM_ENUMERATION(
+ "Memory.Coordinator.StateOnModerateNotificationReceived",
+ state, base::kMemoryStateMax);
+ break;
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL:
+ UMA_HISTOGRAM_ENUMERATION(
+ "Memory.Coordinator.StateOnCriticalNotificationReceived",
+ state, base::kMemoryStateMax);
+ break;
+ case base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE:
+ NOTREACHED();
+ }
+}
+
void MemoryCoordinator::EnableFeaturesForTesting() {
base::FeatureList::ClearInstanceForTesting();
std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
« no previous file with comments | « content/browser/memory/memory_coordinator.h ('k') | content/browser/memory/memory_coordinator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698