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