| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MANAGER_SAMPLING_SHARED_SAMPLER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const OnStartTimeCallback& on_start_time, | 55 const OnStartTimeCallback& on_start_time, |
| 56 const OnCpuTimeCallback& on_cpu_time); | 56 const OnCpuTimeCallback& on_cpu_time); |
| 57 | 57 |
| 58 // Unregisters task group specific callbacks. | 58 // Unregisters task group specific callbacks. |
| 59 void UnregisterCallbacks(base::ProcessId process_id); | 59 void UnregisterCallbacks(base::ProcessId process_id); |
| 60 | 60 |
| 61 // Refreshes the expensive process' stats (for now only idle wakeups per | 61 // Refreshes the expensive process' stats (for now only idle wakeups per |
| 62 // second) on the worker thread. | 62 // second) on the worker thread. |
| 63 void Refresh(base::ProcessId process_id, int64_t refresh_flags); | 63 void Refresh(base::ProcessId process_id, int64_t refresh_flags); |
| 64 | 64 |
| 65 #if defined(OS_WIN) |
| 66 // Specifies a function to use in place of NtQuerySystemInformation. |
| 67 typedef int (*QuerySystemInformationForTest)(unsigned char* buffer, |
| 68 int buffer_size); |
| 69 static void SetQuerySystemInformationForTest( |
| 70 QuerySystemInformationForTest query_system_information); |
| 71 #endif // defined(OS_WIN) |
| 72 |
| 65 private: | 73 private: |
| 66 friend class base::RefCountedThreadSafe<SharedSampler>; | 74 friend class base::RefCountedThreadSafe<SharedSampler>; |
| 67 ~SharedSampler(); | 75 ~SharedSampler(); |
| 68 | 76 |
| 69 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
| 70 // The UI-thread callbacks in TaskGroup registered with RegisterCallbacks and | 78 // The UI-thread callbacks in TaskGroup registered with RegisterCallbacks and |
| 71 // to be called when refresh on the worker thread is done. | 79 // to be called when refresh on the worker thread is done. |
| 72 struct Callbacks { | 80 struct Callbacks { |
| 73 Callbacks(); | 81 Callbacks(); |
| 74 Callbacks(Callbacks&& other); | 82 Callbacks(Callbacks&& other); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // To assert we're running on the correct thread. | 156 // To assert we're running on the correct thread. |
| 149 base::SequenceChecker worker_pool_sequenced_checker_; | 157 base::SequenceChecker worker_pool_sequenced_checker_; |
| 150 #endif // defined(OS_WIN) | 158 #endif // defined(OS_WIN) |
| 151 | 159 |
| 152 DISALLOW_COPY_AND_ASSIGN(SharedSampler); | 160 DISALLOW_COPY_AND_ASSIGN(SharedSampler); |
| 153 }; | 161 }; |
| 154 | 162 |
| 155 } // namespace task_manager | 163 } // namespace task_manager |
| 156 | 164 |
| 157 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ | 165 #endif // CHROME_BROWSER_TASK_MANAGER_SAMPLING_SHARED_SAMPLER_H_ |
| OLD | NEW |