| 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 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; | 72 int64_t GetSqliteMemoryUsed(TaskId task_id) const override; |
| 73 bool GetV8Memory(TaskId task_id, | 73 bool GetV8Memory(TaskId task_id, |
| 74 int64_t* allocated, | 74 int64_t* allocated, |
| 75 int64_t* used) const override; | 75 int64_t* used) const override; |
| 76 bool GetWebCacheStats( | 76 bool GetWebCacheStats( |
| 77 TaskId task_id, | 77 TaskId task_id, |
| 78 blink::WebCache::ResourceTypeStats* stats) const override; | 78 blink::WebCache::ResourceTypeStats* stats) const override; |
| 79 const TaskIdList& GetTaskIdsList() const override; | 79 const TaskIdList& GetTaskIdsList() const override; |
| 80 TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const override; | 80 TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const override; |
| 81 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; | 81 size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const override; |
| 82 TaskId GetTaskIdForWebContents( |
| 83 content::WebContents* web_contents) const override; |
| 82 | 84 |
| 83 // task_management::TaskProviderObserver: | 85 // task_management::TaskProviderObserver: |
| 84 void TaskAdded(Task* task) override; | 86 void TaskAdded(Task* task) override; |
| 85 void TaskRemoved(Task* task) override; | 87 void TaskRemoved(Task* task) override; |
| 86 void TaskUnresponsive(Task* task) override; | 88 void TaskUnresponsive(Task* task) override; |
| 87 | 89 |
| 88 // content::GpuDataManagerObserver: | 90 // content::GpuDataManagerObserver: |
| 89 void OnVideoMemoryUsageStatsUpdate( | 91 void OnVideoMemoryUsageStatsUpdate( |
| 90 const gpu::VideoMemoryUsageStats& gpu_memory_stats) override; | 92 const gpu::VideoMemoryUsageStats& gpu_memory_stats) override; |
| 91 | 93 |
| 92 // The notification method on the UI thread when multiple bytes are read | 94 // The notification method on the UI thread when multiple bytes are read |
| 93 // from URLRequests. This will be called by the |io_thread_helper_| | 95 // from URLRequests. This will be called by the |io_thread_helper_| |
| 94 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); | 96 static void OnMultipleBytesReadUI(std::vector<BytesReadParam>* params); |
| 95 | 97 |
| 96 private: | 98 private: |
| 97 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>; | 99 friend struct base::DefaultLazyInstanceTraits<TaskManagerImpl>; |
| 98 | 100 |
| 99 TaskManagerImpl(); | 101 TaskManagerImpl(); |
| 100 | 102 |
| 101 // task_management::TaskManagerInterface: | 103 // task_management::TaskManagerInterface: |
| 102 void Refresh() override; | 104 void Refresh() override; |
| 103 void StartUpdating() override; | 105 void StartUpdating() override; |
| 104 void StopUpdating() override; | 106 void StopUpdating() override; |
| 105 | 107 |
| 108 // Lookup a task by its pid, child_id and possibly route_id. |
| 109 Task* GetTaskByPidOrRoute(int pid, int child_id, int route_id) const; |
| 110 |
| 106 // Based on |param| the appropriate task will be updated by its network usage. | 111 // Based on |param| the appropriate task will be updated by its network usage. |
| 107 // Returns true if it was able to match |param| to an existing task, returns | 112 // Returns true if it was able to match |param| to an existing task, returns |
| 108 // false otherwise, at which point the caller must explicitly match these | 113 // false otherwise, at which point the caller must explicitly match these |
| 109 // bytes to the browser process by calling this method again with | 114 // bytes to the browser process by calling this method again with |
| 110 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. | 115 // |param.origin_pid = 0| and |param.child_id = param.route_id = -1|. |
| 111 bool UpdateTasksWithBytesRead(const BytesReadParam& param); | 116 bool UpdateTasksWithBytesRead(const BytesReadParam& param); |
| 112 | 117 |
| 113 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; | 118 TaskGroup* GetTaskGroupByTaskId(TaskId task_id) const; |
| 114 Task* GetTaskByTaskId(TaskId task_id) const; | 119 Task* GetTaskByTaskId(TaskId task_id) const; |
| 115 | 120 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 131 // A cached sorted list of the task IDs. | 136 // A cached sorted list of the task IDs. |
| 132 mutable std::vector<TaskId> sorted_task_ids_; | 137 mutable std::vector<TaskId> sorted_task_ids_; |
| 133 | 138 |
| 134 // The manager of the IO thread helper used to handle network bytes | 139 // The manager of the IO thread helper used to handle network bytes |
| 135 // notifications on IO thread. The manager itself lives on the UI thread, but | 140 // notifications on IO thread. The manager itself lives on the UI thread, but |
| 136 // the IO thread helper lives entirely on the IO thread. | 141 // the IO thread helper lives entirely on the IO thread. |
| 137 std::unique_ptr<IoThreadHelperManager> io_thread_helper_manager_; | 142 std::unique_ptr<IoThreadHelperManager> io_thread_helper_manager_; |
| 138 | 143 |
| 139 // The list of the task providers that are owned and observed by this task | 144 // The list of the task providers that are owned and observed by this task |
| 140 // manager implementation. | 145 // manager implementation. |
| 141 ScopedVector<TaskProvider> task_providers_; | 146 std::vector<std::unique_ptr<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 |
| 151 // This will be set to true while there are observers and the task manager is | 156 // This will be set to true while there are observers and the task manager is |
| 152 // running. | 157 // running. |
| 153 bool is_running_; | 158 bool is_running_; |
| 154 | 159 |
| 155 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); | 160 DISALLOW_COPY_AND_ASSIGN(TaskManagerImpl); |
| 156 }; | 161 }; |
| 157 | 162 |
| 158 } // namespace task_management | 163 } // namespace task_management |
| 159 | 164 |
| 160 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ | 165 #endif // CHROME_BROWSER_TASK_MANAGEMENT_SAMPLING_TASK_MANAGER_IMPL_H_ |
| OLD | NEW |