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(TimeDelta::FromSeconds(ADJUSTMENT_INTERVAL_SECONDS), | 51 timer_.Start(FROM_HERE, |
| 52 TimeDelta::FromSeconds(ADJUSTMENT_INTERVAL_SECONDS), |
52 this, | 53 this, |
53 &OomPriorityManager::AdjustOomPriorities); | 54 &OomPriorityManager::AdjustOomPriorities); |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 void OomPriorityManager::StopTimer() { | 58 void OomPriorityManager::StopTimer() { |
58 timer_.Stop(); | 59 timer_.Stop(); |
59 } | 60 } |
60 | 61 |
61 // Returns true if |first| is considered less desirable to be killed | 62 // Returns true if |first| is considered less desirable to be killed |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { | 178 if (already_seen.find(iterator->renderer_handle) == already_seen.end()) { |
178 already_seen.insert(iterator->renderer_handle); | 179 already_seen.insert(iterator->renderer_handle); |
179 ZygoteHost::GetInstance()->AdjustRendererOOMScore( | 180 ZygoteHost::GetInstance()->AdjustRendererOOMScore( |
180 iterator->renderer_handle, static_cast<int>(priority + 0.5f)); | 181 iterator->renderer_handle, static_cast<int>(priority + 0.5f)); |
181 priority += priority_increment; | 182 priority += priority_increment; |
182 } | 183 } |
183 } | 184 } |
184 } | 185 } |
185 | 186 |
186 } // namespace browser | 187 } // namespace browser |
OLD | NEW |