| 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_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ | 6 #define CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // resources than those defined in |resources_flags|. | 66 // resources than those defined in |resources_flags|. |
| 67 // 4- Upon the removal of the observer from the task manager, the task manager | 67 // 4- Upon the removal of the observer from the task manager, the task manager |
| 68 // will update its refresh time and the calculated resources to be the minimum | 68 // will update its refresh time and the calculated resources to be the minimum |
| 69 // required value of all the remaining observers. | 69 // required value of all the remaining observers. |
| 70 TaskManagerObserver(base::TimeDelta refresh_time, int64_t resources_flags); | 70 TaskManagerObserver(base::TimeDelta refresh_time, int64_t resources_flags); |
| 71 virtual ~TaskManagerObserver(); | 71 virtual ~TaskManagerObserver(); |
| 72 | 72 |
| 73 // Notifies the observer that a chrome task with |id| has started and the task | 73 // Notifies the observer that a chrome task with |id| has started and the task |
| 74 // manager is now monitoring it. The resource usage of this newly-added task | 74 // manager is now monitoring it. The resource usage of this newly-added task |
| 75 // will remain invalid until the next refresh cycle of the task manager. | 75 // will remain invalid until the next refresh cycle of the task manager. |
| 76 virtual void OnTaskAdded(TaskId id) = 0; | 76 virtual void OnTaskAdded(TaskId id) {} |
| 77 | 77 |
| 78 // Notifies the observer that a chrome task with |id| is about to be destroyed | 78 // Notifies the observer that a chrome task with |id| is about to be destroyed |
| 79 // and removed from the task manager right after this call. Observers which | 79 // and removed from the task manager right after this call. Observers which |
| 80 // are interested in doing some calculations related to the resource usage of | 80 // are interested in doing some calculations related to the resource usage of |
| 81 // this task upon its removal may do so inside this call. | 81 // this task upon its removal may do so inside this call. |
| 82 virtual void OnTaskToBeRemoved(TaskId id) = 0; | 82 virtual void OnTaskToBeRemoved(TaskId id) {} |
| 83 | 83 |
| 84 // Notifies the observer that the task manager has just finished a refresh | 84 // Notifies the observer that the task manager has just finished a refresh |
| 85 // cycle to calculate the resources usage of all tasks whose IDs are given in | 85 // cycle to calculate the resources usage of all tasks whose IDs are given in |
| 86 // |task_ids|. |task_ids| will be sorted such that the task representing the | 86 // |task_ids|. |task_ids| will be sorted such that the task representing the |
| 87 // browser process is at the top of the list and the rest of the IDs will be | 87 // browser process is at the top of the list and the rest of the IDs will be |
| 88 // sorted by the process IDs on which the tasks are running, then by the task | 88 // sorted by the process IDs on which the tasks are running, then by the task |
| 89 // IDs themselves. | 89 // IDs themselves. |
| 90 virtual void OnTasksRefreshed(const TaskIdList& task_ids) = 0; | 90 virtual void OnTasksRefreshed(const TaskIdList& task_ids) {} |
| 91 | 91 |
| 92 // Notifies the observer that the task manager has just finished a refresh | 92 // Notifies the observer that the task manager has just finished a refresh |
| 93 // cycle that calculated all the resource usage of all tasks whose IDs are in | 93 // cycle that calculated all the resource usage of all tasks whose IDs are in |
| 94 // |task_ids| including the resource usages that are calculated in the | 94 // |task_ids| including the resource usages that are calculated in the |
| 95 // background such CPU and memory (If those refresh types are enabled). | 95 // background such CPU and memory (If those refresh types are enabled). |
| 96 // This event can take longer to be fired, and can miss some changes that may | 96 // This event can take longer to be fired, and can miss some changes that may |
| 97 // happen to non-background calculations in-between two successive | 97 // happen to non-background calculations in-between two successive |
| 98 // invocations. Listen to this ONLY if you must know when all the background | 98 // invocations. Listen to this ONLY if you must know when all the background |
| 99 // resource calculations to be valid for all the available processes. | 99 // resource calculations to be valid for all the available processes. |
| 100 // |task_ids| will be sorted as specified in OnTasksRefreshed() above. | 100 // |task_ids| will be sorted as specified in OnTasksRefreshed() above. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // calculated on each refresh. | 135 // calculated on each refresh. |
| 136 int64_t desired_resources_flags_; | 136 int64_t desired_resources_flags_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); | 138 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace task_management | 141 } // namespace task_management |
| 142 | 142 |
| 143 | 143 |
| 144 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ | 144 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ |
| OLD | NEW |