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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 OomPriorityManager::TabStatsList OomPriorityManager::GetTabStatsOnUIThread() { | 259 OomPriorityManager::TabStatsList OomPriorityManager::GetTabStatsOnUIThread() { |
260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 260 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
261 TabStatsList stats_list; | 261 TabStatsList stats_list; |
262 stats_list.reserve(32); // 99% of users have < 30 tabs open | 262 stats_list.reserve(32); // 99% of users have < 30 tabs open |
263 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); | 263 for (BrowserList::const_iterator browser_iterator = BrowserList::begin(); |
264 browser_iterator != BrowserList::end(); ++browser_iterator) { | 264 browser_iterator != BrowserList::end(); ++browser_iterator) { |
265 Browser* browser = *browser_iterator; | 265 Browser* browser = *browser_iterator; |
266 const TabStripModel* model = browser->tabstrip_model(); | 266 const TabStripModel* model = browser->tabstrip_model(); |
267 for (int i = 0; i < model->count(); i++) { | 267 for (int i = 0; i < model->count(); i++) { |
268 TabContents* contents = model->GetTabContentsAt(i)->tab_contents(); | 268 TabContents* contents = model->GetTabContentsAt(i)->tab_contents(); |
269 if (!contents->is_crashed()) { | 269 if (!contents->IsCrashed()) { |
270 TabStats stats; | 270 TabStats stats; |
271 stats.last_selected = contents->last_selected_time(); | 271 stats.last_selected = contents->GetLastSelectedTime(); |
272 stats.renderer_handle = contents->GetRenderProcessHost()->GetHandle(); | 272 stats.renderer_handle = contents->GetRenderProcessHost()->GetHandle(); |
273 stats.is_pinned = model->IsTabPinned(i); | 273 stats.is_pinned = model->IsTabPinned(i); |
274 stats.is_selected = model->IsTabSelected(i); | 274 stats.is_selected = model->IsTabSelected(i); |
275 stats.title = contents->GetTitle(); | 275 stats.title = contents->GetTitle(); |
276 stats.tab_contents_id = IdFromTabContents(contents); | 276 stats.tab_contents_id = IdFromTabContents(contents); |
277 stats_list.push_back(stats); | 277 stats_list.push_back(stats); |
278 } | 278 } |
279 } | 279 } |
280 } | 280 } |
281 // Sort the data we collected so that least desirable to be | 281 // Sort the data we collected so that least desirable to be |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 ZygoteHost::GetInstance()->AdjustRendererOOMScore( | 324 ZygoteHost::GetInstance()->AdjustRendererOOMScore( |
325 iterator->renderer_handle, score); | 325 iterator->renderer_handle, score); |
326 pid_to_oom_score_[iterator->renderer_handle] = score; | 326 pid_to_oom_score_[iterator->renderer_handle] = score; |
327 } | 327 } |
328 priority += priority_increment; | 328 priority += priority_increment; |
329 } | 329 } |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 } // namespace browser | 333 } // namespace browser |
OLD | NEW |