Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: chrome/browser/task_management/task_manager_observer.h

Issue 1584473004: Migrate ProcessesEventRouter to the new task manager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nit. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 virtual void OnTaskToBeRemoved(TaskId id) = 0; 79 virtual void OnTaskToBeRemoved(TaskId id) = 0;
80 80
81 // Notifies the observer that the task manager has just finished a refresh 81 // Notifies the observer that the task manager has just finished a refresh
82 // cycle to calculate the resources usage of all tasks whose IDs are given in 82 // cycle to calculate the resources usage of all tasks whose IDs are given in
83 // |task_ids|. |task_ids| will be sorted such that the task representing the 83 // |task_ids|. |task_ids| will be sorted such that the task representing the
84 // browser process is at the top of the list and the rest of the IDs will be 84 // browser process is at the top of the list and the rest of the IDs will be
85 // sorted by the process IDs on which the tasks are running, then by the task 85 // sorted by the process IDs on which the tasks are running, then by the task
86 // IDs themselves. 86 // IDs themselves.
87 virtual void OnTasksRefreshed(const TaskIdList& task_ids) = 0; 87 virtual void OnTasksRefreshed(const TaskIdList& task_ids) = 0;
88 88
89 // Notifies the observer that the task manager has just finished a refresh
90 // cycle that calculated all the resource usage of all tasks whose IDs are in
91 // |task_ids| including the resource usages that are calculated in the
92 // background such CPU and memory (If those refresh types are enabled).
93 // This event can take longer to be fired, and can miss some changes that may
94 // happen to non-background calculations in-between two successive
95 // invocations. Listen to this ONLY if you must know when all the background
96 // resource calculations to be valid for all the available processes.
97 // |task_ids| will be sorted as specified in OnTasksRefreshed() above.
98 virtual void OnTasksRefreshedWithBackgroundCalculations(
99 const TaskIdList& task_ids) {}
100
101 // Notifies the observer that the task with |id| is running on a renderer that
102 // has become unresponsive.
103 virtual void OnTaskUnresponsive(TaskId id) {}
104
89 const base::TimeDelta& desired_refresh_time() const { 105 const base::TimeDelta& desired_refresh_time() const {
90 return desired_refresh_time_; 106 return desired_refresh_time_;
91 } 107 }
92 108
93 int64_t desired_resources_flags() const { return desired_resources_flags_; } 109 int64_t desired_resources_flags() const { return desired_resources_flags_; }
94 110
95 protected: 111 protected:
96 TaskManagerInterface* observed_task_manager() const { 112 TaskManagerInterface* observed_task_manager() const {
97 return observed_task_manager_; 113 return observed_task_manager_;
98 } 114 }
99 115
100 // Add or Remove a refresh |type|. 116 // Add or Remove a refresh |type|.
101 void AddRefreshType(RefreshType type); 117 void AddRefreshType(RefreshType type);
102 void RemoveRefreshType(RefreshType type); 118 void RemoveRefreshType(RefreshType type);
119 void SetRefreshTypesFlags(int64_t flags);
103 120
104 private: 121 private:
105 friend class TaskManagerInterface; 122 friend class TaskManagerInterface;
106 123
107 // The currently observed task Manager. 124 // The currently observed task Manager.
108 TaskManagerInterface* observed_task_manager_; 125 TaskManagerInterface* observed_task_manager_;
109 126
110 // The minimum update time of the task manager that this observer needs to 127 // The minimum update time of the task manager that this observer needs to
111 // do its job. 128 // do its job.
112 base::TimeDelta desired_refresh_time_; 129 base::TimeDelta desired_refresh_time_;
113 130
114 // The flags that contain the resources that this observer needs to be 131 // The flags that contain the resources that this observer needs to be
115 // calculated on each refresh. 132 // calculated on each refresh.
116 int64_t desired_resources_flags_; 133 int64_t desired_resources_flags_;
117 134
118 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver); 135 DISALLOW_COPY_AND_ASSIGN(TaskManagerObserver);
119 }; 136 };
120 137
121 } // namespace task_management 138 } // namespace task_management
122 139
123 140
124 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_ 141 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_management/task_manager_interface.cc ('k') | chrome/browser/task_management/task_manager_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698