| 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_MANAGER_IMPL_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> |
| 13 #include <string> |
| 14 #include <vector> |
| 12 | 15 |
| 13 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" | 17 #include "base/macros.h" |
| 15 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
| 16 #include "base/sequenced_task_runner.h" | 19 #include "base/sequenced_task_runner.h" |
| 17 #include "chrome/browser/task_management/providers/task_provider.h" | 20 #include "chrome/browser/task_management/providers/task_provider.h" |
| 18 #include "chrome/browser/task_management/providers/task_provider_observer.h" | 21 #include "chrome/browser/task_management/providers/task_provider_observer.h" |
| 19 #include "chrome/browser/task_management/sampling/task_group.h" | 22 #include "chrome/browser/task_management/sampling/task_group.h" |
| 20 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" | 23 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" |
| 21 #include "chrome/browser/task_management/task_manager_interface.h" | 24 #include "chrome/browser/task_management/task_manager_interface.h" |
| 22 #include "content/public/browser/gpu_data_manager_observer.h" | 25 #include "content/public/browser/gpu_data_manager_observer.h" |
| 23 #include "gpu/ipc/common/memory_stats.h" | 26 #include "gpu/ipc/common/memory_stats.h" |
| 24 | 27 |
| 25 namespace task_management { | 28 namespace task_management { |
| 26 | 29 |
| 30 class SharedSampler; |
| 31 |
| 27 // Defines a concrete implementation of the TaskManagerInterface. | 32 // Defines a concrete implementation of the TaskManagerInterface. |
| 28 class TaskManagerImpl : | 33 class TaskManagerImpl : |
| 29 public TaskManagerInterface, | 34 public TaskManagerInterface, |
| 30 public TaskProviderObserver, | 35 public TaskProviderObserver, |
| 31 content::GpuDataManagerObserver { | 36 content::GpuDataManagerObserver { |
| 32 public: | 37 public: |
| 33 ~TaskManagerImpl() override; | 38 ~TaskManagerImpl() override; |
| 34 | 39 |
| 35 static TaskManagerImpl* GetInstance(); | 40 static TaskManagerImpl* GetInstance(); |
| 36 | 41 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 std::vector<std::unique_ptr<TaskProvider>> task_providers_; | 150 std::vector<std::unique_ptr<TaskProvider>> task_providers_; |
| 146 | 151 |
| 147 // The current GPU memory usage stats that was last received from the | 152 // The current GPU memory usage stats that was last received from the |
| 148 // GpuDataManager. | 153 // GpuDataManager. |
| 149 gpu::VideoMemoryUsageStats gpu_memory_stats_; | 154 gpu::VideoMemoryUsageStats gpu_memory_stats_; |
| 150 | 155 |
| 151 // The specific blocking pool SequencedTaskRunner that will be used to make | 156 // The specific blocking pool SequencedTaskRunner that will be used to make |
| 152 // sure TaskGroupSampler posts their refreshes serially. | 157 // sure TaskGroupSampler posts their refreshes serially. |
| 153 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; | 158 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; |
| 154 | 159 |
| 160 // A special sampler shared with all instances of TaskGroup that calculates a |
| 161 // subset of resources for all processes at once. |
| 162 scoped_refptr<SharedSampler> shared_sampler_; |
| 163 |
| 155 // This will be set to true while there are observers and the task manager is | 164 // This will be set to true while there are observers and the task manager is |
| 156 // running. | 165 // running. |
| 157 bool is_running_; | 166 bool is_running_; |
| 158 | 167 |
| 159 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 168 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 160 }; | 169 }; |
| 161 | 170 |
| 162 } // namespace task_management | 171 } // namespace task_management |
| 163 | 172 |
| 164 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 173 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |