| 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 | 12 |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/sequenced_task_runner.h" | 16 #include "base/sequenced_task_runner.h" |
| 17 #include "chrome/browser/task_management/providers/task_provider.h" | 17 #include "chrome/browser/task_management/providers/task_provider.h" |
| 18 #include "chrome/browser/task_management/providers/task_provider_observer.h" | 18 #include "chrome/browser/task_management/providers/task_provider_observer.h" |
| 19 #include "chrome/browser/task_management/sampling/task_group.h" | 19 #include "chrome/browser/task_management/sampling/task_group.h" |
| 20 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" | 20 #include "chrome/browser/task_management/sampling/task_manager_io_thread_helper.
h" |
| 21 #include "chrome/browser/task_management/task_manager_interface.h" | 21 #include "chrome/browser/task_management/task_manager_interface.h" |
| 22 #include "content/public/browser/gpu_data_manager_observer.h" | 22 #include "content/public/browser/gpu_data_manager_observer.h" |
| 23 #include "gpu/ipc/common/memory_stats.h" |
| 23 | 24 |
| 24 namespace task_management { | 25 namespace task_management { |
| 25 | 26 |
| 26 // Defines a concrete implementation of the TaskManagerInterface. | 27 // Defines a concrete implementation of the TaskManagerInterface. |
| 27 class TaskManagerImpl : | 28 class TaskManagerImpl : |
| 28 public TaskManagerInterface, | 29 public TaskManagerInterface, |
| 29 public TaskProviderObserver, | 30 public TaskProviderObserver, |
| 30 content::GpuDataManagerObserver { | 31 content::GpuDataManagerObserver { |
| 31 public: | 32 public: |
| 32 ~TaskManagerImpl() override; | 33 ~TaskManagerImpl() override; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 blink::WebCache::ResourceTypeStats* stats) const override; | 71 blink::WebCache::ResourceTypeStats* stats) const override; |
| 71 const TaskIdList& GetTaskIdsList() const override; | 72 const TaskIdList& GetTaskIdsList() const override; |
| 72 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 73 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; |
| 73 | 74 |
| 74 // task_management::TaskProviderObserver: | 75 // task_management::TaskProviderObserver: |
| 75 void TaskAdded(Task* task) override; | 76 void TaskAdded(Task* task) override; |
| 76 void TaskRemoved(Task* task) override; | 77 void TaskRemoved(Task* task) override; |
| 77 | 78 |
| 78 // content::GpuDataManagerObserver: | 79 // content::GpuDataManagerObserver: |
| 79 void OnVideoMemoryUsageStatsUpdate( | 80 void OnVideoMemoryUsageStatsUpdate( |
| 80 const content::GPUVideoMemoryUsageStats& gpu_memory_stats) override; | 81 const gpu::VideoMemoryUsageStats& gpu_memory_stats) override; |
| 81 | 82 |
| 82 // The notification method on the UI thread when multiple bytes are read | 83 // The notification method on the UI thread when multiple bytes are read |
| 83 // from URLRequests. This will be called by the |io_thread_helper_| | 84 // from URLRequests. This will be called by the |io_thread_helper_| |
| 84 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); | 85 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); |
| 85 | 86 |
| 86 private: | 87 private: |
| 87 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>; | 88 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>; |
| 88 | 89 |
| 89 TaskManagerImpl(); | 90 TaskManagerImpl(); |
| 90 | 91 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 119 // notifications on IO thread. The manager itself lives on the UI thread, but | 120 // notifications on IO thread. The manager itself lives on the UI thread, but |
| 120 // the IO thread helper lives entirely on the IO thread. | 121 // the IO thread helper lives entirely on the IO thread. |
| 121 scoped_ptr<IoThreadHelperManager> io_thread_helper_manager_; | 122 scoped_ptr<IoThreadHelperManager> io_thread_helper_manager_; |
| 122 | 123 |
| 123 // The list of the task providers that are owned and observed by this task | 124 // The list of the task providers that are owned and observed by this task |
| 124 // manager implementation. | 125 // manager implementation. |
| 125 ScopedVector<TaskProvider> task_providers_; | 126 ScopedVector<TaskProvider> task_providers_; |
| 126 | 127 |
| 127 // The current GPU memory usage stats that was last received from the | 128 // The current GPU memory usage stats that was last received from the |
| 128 // GpuDataManager. | 129 // GpuDataManager. |
| 129 content::GPUVideoMemoryUsageStats gpu_memory_stats_; | 130 gpu::VideoMemoryUsageStats gpu_memory_stats_; |
| 130 | 131 |
| 131 // The specific blocking pool SequencedTaskRunner that will be used to make | 132 // The specific blocking pool SequencedTaskRunner that will be used to make |
| 132 // sure TaskGroupSampler posts their refreshes serially. | 133 // sure TaskGroupSampler posts their refreshes serially. |
| 133 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; | 134 scoped_refptr<base::SequencedTaskRunner> blocking_pool_runner_; |
| 134 | 135 |
| 135 // This will be set to true while there are observers and the task manager is | 136 // This will be set to true while there are observers and the task manager is |
| 136 // running. | 137 // running. |
| 137 bool is_running_; | 138 bool is_running_; |
| 138 | 139 |
| 139 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 140 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 140 }; | 141 }; |
| 141 | 142 |
| 142 } // namespace task_management | 143 } // namespace task_management |
| 143 | 144 |
| 144 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 145 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |