OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/oom_priority_manager.h" | 5 #include "chrome/browser/oom_priority_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const int kMaxPriority = 10; | 159 const int kMaxPriority = 10; |
160 const int kPriorityRange = kMaxPriority - kMinPriority; | 160 const int kPriorityRange = kMaxPriority - kMinPriority; |
161 float priority_increment = | 161 float priority_increment = |
162 static_cast<float>(kPriorityRange) / renderer_stats.size(); | 162 static_cast<float>(kPriorityRange) / renderer_stats.size(); |
163 float priority = kMinPriority; | 163 float priority = kMinPriority; |
164 std::set<base::ProcessHandle> already_seen; | 164 std::set<base::ProcessHandle> already_seen; |
165 for (StatsList::iterator iterator = renderer_stats.begin(); | 165 for (StatsList::iterator iterator = renderer_stats.begin(); |
166 iterator != renderer_stats.end(); ++iterator) { | 166 iterator != renderer_stats.end(); ++iterator) { |
167 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { | 167 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { |
168 already_seen.insert(iterator->renderer_handle); | 168 already_seen.insert(iterator->renderer_handle); |
169 Singleton<ZygoteHost>::get()->AdjustRendererOOMScore( | 169 ZygoteHost::GetInstance()->AdjustRendererOOMScore( |
170 iterator->renderer_handle, | 170 iterator->renderer_handle, |
171 static_cast<int>(priority + 0.5f)); | 171 static_cast<int>(priority + 0.5f)); |
172 priority += priority_increment; | 172 priority += priority_increment; |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 | 176 |
177 } // namespace browser | 177 } // namespace browser |
OLD | NEW |