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

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

Issue 2874023003: Don't kill a process if it has IMPORTANT_FOREGROUND or higher priority (Closed)
Patch Set: Created 3 years, 7 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 | chrome/browser/memory/tab_manager_delegate_chromeos_unittest.cc » ('j') | no next file with comments »
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Impossible case. If app and tab are mixed in one process type, favor 145 // Impossible case. If app and tab are mixed in one process type, favor
146 // apps. 146 // apps.
147 NOTREACHED() << "Undefined comparison between apps and tabs"; 147 NOTREACHED() << "Undefined comparison between apps and tabs";
148 return app(); 148 return app();
149 } 149 }
150 150
151 ProcessType TabManagerDelegate::Candidate::GetProcessTypeInternal() const { 151 ProcessType TabManagerDelegate::Candidate::GetProcessTypeInternal() const {
152 if (app()) { 152 if (app()) {
153 if (app()->is_focused()) 153 if (app()->is_focused())
154 return ProcessType::FOCUSED_APP; 154 return ProcessType::FOCUSED_APP;
155 if (app()->process_state() == arc::mojom::ProcessState::TOP) 155 if (app()->process_state() <=
156 arc::mojom::ProcessState::IMPORTANT_FOREGROUND) {
156 return ProcessType::VISIBLE_APP; 157 return ProcessType::VISIBLE_APP;
158 }
157 return ProcessType::BACKGROUND_APP; 159 return ProcessType::BACKGROUND_APP;
158 } 160 }
159 if (tab()) { 161 if (tab()) {
160 if (tab()->is_selected) 162 if (tab()->is_selected)
161 return ProcessType::FOCUSED_TAB; 163 return ProcessType::FOCUSED_TAB;
162 return ProcessType::BACKGROUND_TAB; 164 return ProcessType::BACKGROUND_TAB;
163 } 165 }
164 NOTREACHED() << "Unexpected process type"; 166 NOTREACHED() << "Unexpected process type";
165 return ProcessType::UNKNOWN_TYPE; 167 return ProcessType::UNKNOWN_TYPE;
166 } 168 }
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 737 }
736 priority += priority_increment; 738 priority += priority_increment;
737 } 739 }
738 740
739 if (oom_scores_to_change.size()) 741 if (oom_scores_to_change.size())
740 GetDebugDaemonClient()->SetOomScoreAdj( 742 GetDebugDaemonClient()->SetOomScoreAdj(
741 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj)); 743 oom_scores_to_change, base::Bind(&OnSetOomScoreAdj));
742 } 744 }
743 745
744 } // namespace memory 746 } // namespace memory
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager_delegate_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698