| 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_TASK_MANAGER_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/process/kill.h" | 16 #include "base/process/kill.h" |
| 17 #include "base/process/process_handle.h" | 17 #include "base/process/process_handle.h" |
| 18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
| 20 #include "chrome/browser/task_management/providers/task.h" | 20 #include "chrome/browser/task_management/providers/task.h" |
| 21 #include "chrome/browser/task_management/task_manager_observer.h" | 21 #include "chrome/browser/task_management/task_manager_observer.h" |
| 22 #include "third_party/WebKit/public/web/WebCache.h" | 22 #include "third_party/WebKit/public/web/WebCache.h" |
| 23 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 24 | 24 |
| 25 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
| 26 | 26 |
| 27 namespace content { |
| 28 class WebContents; |
| 29 } // namespace content |
| 30 |
| 27 namespace net { | 31 namespace net { |
| 28 class URLRequest; | 32 class URLRequest; |
| 29 } // namespace net | 33 } // namespace net |
| 30 | 34 |
| 31 namespace task_management { | 35 namespace task_management { |
| 32 | 36 |
| 33 // Defines the interface for any implementation of the task manager. | 37 // Defines the interface for any implementation of the task manager. |
| 34 // Concrete implementations have no control over the refresh rate nor the | 38 // Concrete implementations have no control over the refresh rate nor the |
| 35 // enabled calculations of the usage of the various resources. | 39 // enabled calculations of the usage of the various resources. |
| 36 class TaskManagerInterface { | 40 class TaskManagerInterface { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 virtual const TaskIdList& GetTaskIdsList() const = 0; | 202 virtual const TaskIdList& GetTaskIdsList() const = 0; |
| 199 | 203 |
| 200 // Gets the list of task IDs of the tasks that run on the same process as the | 204 // Gets the list of task IDs of the tasks that run on the same process as the |
| 201 // task with |task_id|. The returned list will at least include |task_id|. | 205 // task with |task_id|. The returned list will at least include |task_id|. |
| 202 virtual TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const = 0; | 206 virtual TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const = 0; |
| 203 | 207 |
| 204 // Gets the number of task-manager tasks running on the same process on which | 208 // Gets the number of task-manager tasks running on the same process on which |
| 205 // the Task with |task_id| is running. | 209 // the Task with |task_id| is running. |
| 206 virtual size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const = 0; | 210 virtual size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const = 0; |
| 207 | 211 |
| 212 // Returns the TaskId associated with the main task for |web_contents|. |
| 213 // Returns -1 if |web_contents| is nullptr or does not currently have an |
| 214 // associated Task. |
| 215 virtual TaskId GetTaskIdForWebContents( |
| 216 content::WebContents* web_contents) const = 0; |
| 217 |
| 208 // Returns true if the resource |type| usage calculation is enabled and | 218 // Returns true if the resource |type| usage calculation is enabled and |
| 209 // the implementation should refresh its value (this means that at least one | 219 // the implementation should refresh its value (this means that at least one |
| 210 // of the observers require this value). False otherwise. | 220 // of the observers require this value). False otherwise. |
| 211 bool IsResourceRefreshEnabled(RefreshType type) const; | 221 bool IsResourceRefreshEnabled(RefreshType type) const; |
| 212 | 222 |
| 213 protected: | 223 protected: |
| 214 TaskManagerInterface(); | 224 TaskManagerInterface(); |
| 215 virtual ~TaskManagerInterface(); | 225 virtual ~TaskManagerInterface(); |
| 216 | 226 |
| 217 // Notifying observers of various events. | 227 // Notifying observers of various events. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 275 |
| 266 // The flags containing the enabled resources types calculations. | 276 // The flags containing the enabled resources types calculations. |
| 267 int64_t enabled_resources_flags_; | 277 int64_t enabled_resources_flags_; |
| 268 | 278 |
| 269 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); | 279 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); |
| 270 }; | 280 }; |
| 271 | 281 |
| 272 } // namespace task_management | 282 } // namespace task_management |
| 273 | 283 |
| 274 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ | 284 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ |
| OLD | NEW |