OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 30 matching lines...) Expand all Loading... |
41 OomPriorityManager::OomPriorityManager() { | 41 OomPriorityManager::OomPriorityManager() { |
42 StartTimer(); | 42 StartTimer(); |
43 } | 43 } |
44 | 44 |
45 OomPriorityManager::~OomPriorityManager() { | 45 OomPriorityManager::~OomPriorityManager() { |
46 StopTimer(); | 46 StopTimer(); |
47 } | 47 } |
48 | 48 |
49 void OomPriorityManager::StartTimer() { | 49 void OomPriorityManager::StartTimer() { |
50 if (!timer_.IsRunning()) { | 50 if (!timer_.IsRunning()) { |
51 timer_.Start(FROM_HERE, | 51 timer_.Start(TimeDelta::FromSeconds(ADJUSTMENT_INTERVAL_SECONDS), |
52 TimeDelta::FromSeconds(ADJUSTMENT_INTERVAL_SECONDS), | |
53 this, | 52 this, |
54 &OomPriorityManager::AdjustOomPriorities); | 53 &OomPriorityManager::AdjustOomPriorities); |
55 } | 54 } |
56 } | 55 } |
57 | 56 |
58 void OomPriorityManager::StopTimer() { | 57 void OomPriorityManager::StopTimer() { |
59 timer_.Stop(); | 58 timer_.Stop(); |
60 } | 59 } |
61 | 60 |
62 // Returns true if |first| is considered less desirable to be killed | 61 // Returns true if |first| is considered less desirable to be killed |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { | 177 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { |
179 already_seen.insert(iterator->renderer_handle); | 178 already_seen.insert(iterator->renderer_handle); |
180 ZygoteHost::GetInstance()->AdjustRendererOOMScore( | 179 ZygoteHost::GetInstance()->AdjustRendererOOMScore( |
181 iterator->renderer_handle, static_cast<int>(priority + 0.5f)); | 180 iterator->renderer_handle, static_cast<int>(priority + 0.5f)); |
182 priority += priority_increment; | 181 priority += priority_increment; |
183 } | 182 } |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 } // namespace browser | 186 } // namespace browser |
OLD | NEW |