Index: chrome/browser/task_management/sampling/task_group.cc |
diff --git a/chrome/browser/task_management/sampling/task_group.cc b/chrome/browser/task_management/sampling/task_group.cc |
index 929d3b8deb6fc0b06ca797505dcb70669b318bca..8db90c0c861148453796f1bab46342bde29737ca 100644 |
--- a/chrome/browser/task_management/sampling/task_group.cc |
+++ b/chrome/browser/task_management/sampling/task_group.cc |
@@ -75,15 +75,18 @@ TaskGroup::TaskGroup( |
#endif // !defined(DISABLE_NACL) |
idle_wakeups_per_second_(-1), |
gpu_memory_has_duplicates_(false), |
+ is_backgrounded_(false), |
weak_ptr_factory_(this) { |
scoped_refptr<TaskGroupSampler> sampler( |
- new TaskGroupSampler(proc_handle, |
+ new TaskGroupSampler(base::Process::Open(proc_id), |
blocking_pool_runner, |
base::Bind(&TaskGroup::OnCpuRefreshDone, |
weak_ptr_factory_.GetWeakPtr()), |
base::Bind(&TaskGroup::OnMemoryUsageRefreshDone, |
weak_ptr_factory_.GetWeakPtr()), |
base::Bind(&TaskGroup::OnIdleWakeupsRefreshDone, |
+ weak_ptr_factory_.GetWeakPtr()), |
+ base::Bind(&TaskGroup::OnProcessPriorityDone, |
weak_ptr_factory_.GetWeakPtr()))); |
worker_thread_sampler_.swap(sampler); |
} |
@@ -149,6 +152,7 @@ void TaskGroup::Refresh( |
// 5- CPU usage. |
// 6- Memory usage. |
// 7- Idle Wakeups per second. |
+ // 8- Process priority (foreground vs. background). |
worker_thread_sampler_->Refresh(refresh_flags); |
} |
@@ -215,4 +219,10 @@ void TaskGroup::OnIdleWakeupsRefreshDone(int idle_wakeups_per_second) { |
idle_wakeups_per_second_ = idle_wakeups_per_second; |
} |
+void TaskGroup::OnProcessPriorityDone(bool is_backgrounded) { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ |
+ is_backgrounded_ = is_backgrounded; |
+} |
+ |
} // namespace task_management |