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

Side by Side Diff: chrome/browser/task_manager/sampling/task_manager_impl.cc

Issue 2653563003: Add a "Keepalive count" column to Task Manager. (Closed)
Patch Set: Add missing definition for use_titlecase builds Created 3 years, 10 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
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/task_manager/sampling/task_manager_impl.h" 5 #include "chrome/browser/task_manager/sampling/task_manager_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 blink::WebCache::ResourceTypeStats* stats) const { 266 blink::WebCache::ResourceTypeStats* stats) const {
267 const Task* task = GetTaskByTaskId(task_id); 267 const Task* task = GetTaskByTaskId(task_id);
268 if (!task->ReportsWebCacheStats()) 268 if (!task->ReportsWebCacheStats())
269 return false; 269 return false;
270 270
271 *stats = task->GetWebCacheStats(); 271 *stats = task->GetWebCacheStats();
272 272
273 return true; 273 return true;
274 } 274 }
275 275
276 int TaskManagerImpl::GetKeepaliveCount(TaskId task_id) const {
277 const Task* task = GetTaskByTaskId(task_id);
278 if (!task)
279 return -1;
280
281 return task->GetKeepaliveCount();
282 }
283
276 const TaskIdList& TaskManagerImpl::GetTaskIdsList() const { 284 const TaskIdList& TaskManagerImpl::GetTaskIdsList() const {
277 DCHECK(is_running_) << "Task manager is not running. You must observe the " 285 DCHECK(is_running_) << "Task manager is not running. You must observe the "
278 "task manager for it to start running"; 286 "task manager for it to start running";
279 287
280 if (sorted_task_ids_.empty()) { 288 if (sorted_task_ids_.empty()) {
281 // |comparator| groups and sorts by subtask-ness (to push all subtasks to be 289 // |comparator| groups and sorts by subtask-ness (to push all subtasks to be
282 // last), then by process type (e.g. the browser process should be first; 290 // last), then by process type (e.g. the browser process should be first;
283 // renderer processes should be together), then tab id (processes used by 291 // renderer processes should be together), then tab id (processes used by
284 // the same tab should be kept together, and a tab should have a stable 292 // the same tab should be kept together, and a tab should have a stable
285 // position in the list as it cycles through processes, and tab creation 293 // position in the list as it cycles through processes, and tab creation
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 groups_itr.second->AreBackgroundCalculationsDone(); 570 groups_itr.second->AreBackgroundCalculationsDone();
563 } 571 }
564 if (are_all_processes_data_ready) { 572 if (are_all_processes_data_ready) {
565 NotifyObserversOnRefreshWithBackgroundCalculations(GetTaskIdsList()); 573 NotifyObserversOnRefreshWithBackgroundCalculations(GetTaskIdsList());
566 for (const auto& groups_itr : task_groups_by_proc_id_) 574 for (const auto& groups_itr : task_groups_by_proc_id_)
567 groups_itr.second->ClearCurrentBackgroundCalculationsFlags(); 575 groups_itr.second->ClearCurrentBackgroundCalculationsFlags();
568 } 576 }
569 } 577 }
570 578
571 } // namespace task_manager 579 } // namespace task_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698