OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |