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

Side by Side Diff: chrome/browser/memory/tab_manager_delegate_chromeos.cc

Issue 1891423003: TabManagerDelegator: Disable kernel lowmemorykiller if memory management is handled by Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/arc/common/process.mojom » ('j') | components/arc/common/process.mojom » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h" 5 #include "chrome/browser/memory/tab_manager_delegate_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 arc_bridge_service->RemoveObserver(this); 127 arc_bridge_service->RemoveObserver(this);
128 } 128 }
129 129
130 void TabManagerDelegate::OnProcessInstanceReady() { 130 void TabManagerDelegate::OnProcessInstanceReady() {
131 auto arc_bridge_service = arc::ArcBridgeService::Get(); 131 auto arc_bridge_service = arc::ArcBridgeService::Get();
132 DCHECK(arc_bridge_service); 132 DCHECK(arc_bridge_service);
133 133
134 arc_process_instance_ = arc_bridge_service->process_instance(); 134 arc_process_instance_ = arc_bridge_service->process_instance();
135 arc_process_instance_version_ = arc_bridge_service->process_version(); 135 arc_process_instance_version_ = arc_bridge_service->process_version();
136 136
137 DCHECK(arc_process_instance_);
138
137 if (!IsArcMemoryManagementEnabled()) 139 if (!IsArcMemoryManagementEnabled())
138 return; 140 return;
139 141
140 DCHECK(arc_process_instance_);
141 if (arc_process_instance_version_ < 2) { 142 if (arc_process_instance_version_ < 2) {
142 VLOG(1) << "arc::ProcessInstance version < 2 does not " 143 VLOG(1) << "arc::ProcessInstance version < 2 does not "
143 "support DisableBuiltinOomAdjustment() yet."; 144 "support DisableBuiltinOomAdjustment() yet.";
144 return; 145 return;
145 } 146 }
146 // If --enable-arc-memory-management is on, stop Android system-wide 147 // If --enable-arc-memory-management is on, stop Android system-wide
147 // oom_adj adjustment since this class will take over oom_score_adj settings. 148 // oom_adj adjustment since this class will take over oom_score_adj settings.
148 arc_process_instance_->DisableBuiltinOomAdjustment(); 149 arc_process_instance_->DisableBuiltinOomAdjustment();
150
151 if (arc_process_instance_version_ < 3) {
152 VLOG(1) << "arc::ProcessInstance version < 3 does not "
153 "support DisableLowMemoryKiller() yet.";
154 return;
155 }
156 arc_process_instance_->DisableLowMemoryKiller();
149 } 157 }
150 158
151 void TabManagerDelegate::OnProcessInstanceClosed() { 159 void TabManagerDelegate::OnProcessInstanceClosed() {
152 arc_process_instance_ = nullptr; 160 arc_process_instance_ = nullptr;
153 arc_process_instance_version_ = 0; 161 arc_process_instance_version_ = 0;
154 } 162 }
155 163
156 // If able to get the list of ARC procsses, prioritize tabs and apps as a whole. 164 // If able to get the list of ARC procsses, prioritize tabs and apps as a whole.
157 // Otherwise try to kill tabs only. 165 // Otherwise try to kill tabs only.
158 void TabManagerDelegate::LowMemoryKill( 166 void TabManagerDelegate::LowMemoryKill(
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 484 }
477 } 485 }
478 priority += priority_increment; 486 priority += priority_increment;
479 } 487 }
480 488
481 if (oom_score_for_tabs.size()) 489 if (oom_score_for_tabs.size())
482 SetOomScoreAdjForTabs(oom_score_for_tabs); 490 SetOomScoreAdjForTabs(oom_score_for_tabs);
483 } 491 }
484 492
485 } // namespace memory 493 } // namespace memory
OLDNEW
« no previous file with comments | « no previous file | components/arc/common/process.mojom » ('j') | components/arc/common/process.mojom » ('J')

Powered by Google App Engine
This is Rietveld 408576698