| 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 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 MemoryUsageStats() {} | 34 MemoryUsageStats() {} |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 // Defines the expensive process' stats sampler that will calculate these | 37 // Defines the expensive process' stats sampler that will calculate these |
| 38 // resources on the worker thread. Objects of this class are created by the | 38 // resources on the worker thread. Objects of this class are created by the |
| 39 // TaskGroups on the UI thread, however it will be used mainly on a blocking | 39 // TaskGroups on the UI thread, however it will be used mainly on a blocking |
| 40 // pool thread. | 40 // pool thread. |
| 41 class TaskGroupSampler : public base::RefCountedThreadSafe<TaskGroupSampler> { | 41 class TaskGroupSampler : public base::RefCountedThreadSafe<TaskGroupSampler> { |
| 42 public: | 42 public: |
| 43 // The below are the types of the callbacks to the UI thread upon their | 43 // Below are the types of callbacks that are invoked on the UI thread upon |
| 44 // corresponding refresh are done on the worker thread. | 44 // completion of corresponding refresh tasks on the worker thread. |
| 45 using OnCpuRefreshCallback = base::Callback<void(double)>; | 45 using OnCpuRefreshCallback = base::Callback<void(double)>; |
| 46 using OnMemoryRefreshCallback = base::Callback<void(MemoryUsageStats)>; | 46 using OnMemoryRefreshCallback = base::Callback<void(MemoryUsageStats)>; |
| 47 using OnIdleWakeupsCallback = base::Callback<void(int)>; | 47 using OnIdleWakeupsCallback = base::Callback<void(int)>; |
| 48 #if defined(OS_LINUX) | 48 #if defined(OS_LINUX) |
| 49 using OnOpenFdCountCallback = base::Callback<void(int)>; | 49 using OnOpenFdCountCallback = base::Callback<void(int)>; |
| 50 #endif // defined(OS_LINUX) | 50 #endif // defined(OS_LINUX) |
| 51 using OnProcessPriorityCallback = base::Callback<void(bool)>; | 51 using OnProcessPriorityCallback = base::Callback<void(bool)>; |
| 52 | 52 |
| 53 TaskGroupSampler( | 53 TaskGroupSampler( |
| 54 base::Process process, | 54 base::Process process, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // To assert we're running on the correct thread. | 101 // To assert we're running on the correct thread. |
| 102 base::SequenceChecker worker_pool_sequenced_checker_; | 102 base::SequenceChecker worker_pool_sequenced_checker_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(TaskGroupSampler); | 104 DISALLOW_COPY_AND_ASSIGN(TaskGroupSampler); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace task_management | 107 } // namespace task_management |
| 108 | 108 |
| 109 | 109 |
| 110 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ | 110 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_GROUP_SAMPLER_H_ |
| OLD | NEW |