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

Unified Diff: athena/resource_manager/resource_manager_impl.cc

Issue 548633005: Adding overview / layer framework to Activities so that unloaded / sleeping activities can be shown… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, fixed resulting problems and addressed comments Created 6 years, 3 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: athena/resource_manager/resource_manager_impl.cc
diff --git a/athena/resource_manager/resource_manager_impl.cc b/athena/resource_manager/resource_manager_impl.cc
index 4036ebc20a74f9495e47aa1ea066618d30a03146..ec6d1c1cb1702bddc8c922aa9c3210ac136e9489 100644
--- a/athena/resource_manager/resource_manager_impl.cc
+++ b/athena/resource_manager/resource_manager_impl.cc
@@ -176,8 +176,10 @@ void ResourceManagerImpl::OnOverviewModeEnter() {
void ResourceManagerImpl::OnOverviewModeExit() {
in_overview_mode_ = false;
- // Reorder the activities.
+ // Reorder the activities and manage the resources again since an order change
+ // might have caused a visibility change.
UpdateActivityOrder();
+ ManageResource();
}
void ResourceManagerImpl::OnSplitViewModeEnter() {
@@ -247,7 +249,7 @@ void ResourceManagerImpl::ManageResource() {
max_running_activities = 5;
break;
case MEMORY_PRESSURE_CRITICAL:
- max_running_activities = 0;
+ max_running_activities = 1 + (in_splitview_mode_ ? 1 : 0);
break;
case MEMORY_PRESSURE_MODERATE:
max_running_activities = 7;
@@ -265,7 +267,7 @@ void ResourceManagerImpl::ManageResource() {
// pressure gets critical we only hold as many as are really visible.
size_t max_activities = kMaxVisibleActivities;
if (current_memory_pressure_ == MEMORY_PRESSURE_CRITICAL)
- max_activities = 1 + (in_splitview_mode_ ? 1 : 0);
+ max_activities = max_running_activities;
// Restart and / or bail if the order of activities changes due to our calls.
activity_order_changed_ = false;
@@ -287,11 +289,13 @@ void ResourceManagerImpl::ManageResource() {
Activity::ACTIVITY_INVISIBLE;
// Only change the state when it changes. Note that when the memory
// pressure is critical, only the primary activities (1 or 2) are made
- // visible. Furthermore, in relaxed mode we only want to make visible.
+ // visible. Furthermore, in relaxed mode we only want to turn visible,
+ // never invisible.
if (visiblity_state != state &&
(current_memory_pressure_ != MEMORY_PRESSURE_LOW ||
- visiblity_state == Activity::ACTIVITY_VISIBLE))
+ visiblity_state == Activity::ACTIVITY_VISIBLE)) {
activity->SetCurrentState(visiblity_state);
+ }
}
// See which index we should handle next.

Powered by Google App Engine
This is Rietveld 408576698