OLD | NEW |
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_management/sampling/task_group_sampler.h" | 5 #include "chrome/browser/task_management/sampling/task_group_sampler.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
10 #include "chrome/browser/task_management/task_manager_observer.h" | 12 #include "chrome/browser/task_management/task_manager_observer.h" |
11 #include "content/public/browser/browser_child_process_host.h" | 13 #include "content/public/browser/browser_child_process_host.h" |
12 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
13 | 15 |
14 namespace task_management { | 16 namespace task_management { |
15 | 17 |
16 namespace { | 18 namespace { |
(...skipping 17 matching lines...) Expand all Loading... |
34 TaskGroupSampler::TaskGroupSampler( | 36 TaskGroupSampler::TaskGroupSampler( |
35 base::Process process, | 37 base::Process process, |
36 const scoped_refptr<base::SequencedTaskRunner>& blocking_pool_runner, | 38 const scoped_refptr<base::SequencedTaskRunner>& blocking_pool_runner, |
37 const OnCpuRefreshCallback& on_cpu_refresh, | 39 const OnCpuRefreshCallback& on_cpu_refresh, |
38 const OnMemoryRefreshCallback& on_memory_refresh, | 40 const OnMemoryRefreshCallback& on_memory_refresh, |
39 const OnIdleWakeupsCallback& on_idle_wakeups, | 41 const OnIdleWakeupsCallback& on_idle_wakeups, |
40 #if defined(OS_LINUX) | 42 #if defined(OS_LINUX) |
41 const OnOpenFdCountCallback& on_open_fd_count, | 43 const OnOpenFdCountCallback& on_open_fd_count, |
42 #endif // defined(OS_LINUX) | 44 #endif // defined(OS_LINUX) |
43 const OnProcessPriorityCallback& on_process_priority) | 45 const OnProcessPriorityCallback& on_process_priority) |
44 : process_(process.Pass()), | 46 : process_(std::move(process)), |
45 process_metrics_(CreateProcessMetrics(process_.Handle())), | 47 process_metrics_(CreateProcessMetrics(process_.Handle())), |
46 blocking_pool_runner_(blocking_pool_runner), | 48 blocking_pool_runner_(blocking_pool_runner), |
47 on_cpu_refresh_callback_(on_cpu_refresh), | 49 on_cpu_refresh_callback_(on_cpu_refresh), |
48 on_memory_refresh_callback_(on_memory_refresh), | 50 on_memory_refresh_callback_(on_memory_refresh), |
49 on_idle_wakeups_callback_(on_idle_wakeups), | 51 on_idle_wakeups_callback_(on_idle_wakeups), |
50 #if defined(OS_LINUX) | 52 #if defined(OS_LINUX) |
51 on_open_fd_count_callback_(on_open_fd_count), | 53 on_open_fd_count_callback_(on_open_fd_count), |
52 #endif // defined(OS_LINUX) | 54 #endif // defined(OS_LINUX) |
53 on_process_priority_callback_(on_process_priority) { | 55 on_process_priority_callback_(on_process_priority) { |
54 DCHECK(blocking_pool_runner.get()); | 56 DCHECK(blocking_pool_runner.get()); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 164 } |
163 #endif // defined(OS_LINUX) | 165 #endif // defined(OS_LINUX) |
164 | 166 |
165 bool TaskGroupSampler::RefreshProcessPriority() { | 167 bool TaskGroupSampler::RefreshProcessPriority() { |
166 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread()); | 168 DCHECK(worker_pool_sequenced_checker_.CalledOnValidSequencedThread()); |
167 | 169 |
168 return process_.IsProcessBackgrounded(); | 170 return process_.IsProcessBackgrounded(); |
169 } | 171 } |
170 | 172 |
171 } // namespace task_management | 173 } // namespace task_management |
OLD | NEW |