| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 ScopedVector<TaskProvider> task_providers_; | 146 ScopedVector<TaskProvider> task_providers_; |
| 142 | 147 |
| 143 // The current GPU memory usage stats that was last received from the | 148 // The current GPU memory usage stats that was last received from the |
| 144 // GpuDataManager. | 149 // GpuDataManager. |
| 145 gpu::VideoMemoryUsageStats gpu_memory_stats_; | 150 gpu::VideoMemoryUsageStats gpu_memory_stats_; |
| 146 | 151 |
| 147 // The specific blocking pool SequencedTaskRunner that will be used to make | 152 // The specific blocking pool SequencedTaskRunner that will be used to make |
| 148 // sure TaskGroupSampler posts their refreshes serially. | 153 // sure TaskGroupSampler posts their refreshes serially. |
| 149 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; | 154 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; |
| 150 | 155 |
| 156 // A special sampler shared with all instances of TaskGroup that calculates a |
| 157 // subset of resources for all processes at once. |
| 158 scoped_refptr<SharedSampler> shared_sampler_; |
| 159 |
| 151 // This will be set to true while there are observers and the task manager is | 160 // This will be set to true while there are observers and the task manager is |
| 152 // running. | 161 // running. |
| 153 bool is_running_; | 162 bool is_running_; |
| 154 | 163 |
| 155 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 164 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 156 }; | 165 }; |
| 157 | 166 |
| 158 } // namespace task_management | 167 } // namespace task_management |
| 159 | 168 |
| 160 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 169 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |