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

Side by Side Diff: chrome/browser/task_management/task_manager_interface.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_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 #include <utility> 10 #include <utility>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/process/kill.h"
15 #include "base/process/process_handle.h" 16 #include "base/process/process_handle.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
18 #include "chrome/browser/task_management/providers/task.h" 19 #include "chrome/browser/task_management/providers/task.h"
19 #include "chrome/browser/task_management/task_manager_observer.h" 20 #include "chrome/browser/task_management/task_manager_observer.h"
20 #include "third_party/WebKit/public/web/WebCache.h" 21 #include "third_party/WebKit/public/web/WebCache.h"
21 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
22 23
23 namespace net { 24 namespace net {
24 class URLRequest; 25 class URLRequest;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 virtual const gfx::ImageSkia& GetIcon(TaskId task_id) const = 0; 112 virtual const gfx::ImageSkia& GetIcon(TaskId task_id) const = 0;
112 113
113 // Returns the ID and handle of the process on which the task with |task_id| 114 // Returns the ID and handle of the process on which the task with |task_id|
114 // is running. 115 // is running.
115 virtual const base::ProcessHandle& GetProcessHandle(TaskId task_id) const = 0; 116 virtual const base::ProcessHandle& GetProcessHandle(TaskId task_id) const = 0;
116 virtual const base::ProcessId& GetProcessId(TaskId task_id) const = 0; 117 virtual const base::ProcessId& GetProcessId(TaskId task_id) const = 0;
117 118
118 // Returns the type of the task with |task_id|. 119 // Returns the type of the task with |task_id|.
119 virtual Task::Type GetType(TaskId task_id) const = 0; 120 virtual Task::Type GetType(TaskId task_id) const = 0;
120 121
122 // Gets the unique ID of the tab if the task with |task_id| represents a
123 // WebContents of a tab. Returns -1 otherwise.
124 virtual int GetTabId(TaskId task_id) const = 0;
125
126 // Returns the unique ID of the BrowserChildProcessHost/RenderProcessHost on
127 // which the task with |task_id| is running. It is not the PID nor the handle
128 // of the process.
129 // For a task that represents the browser process, the return value is 0.
130 // For a task that doesn't have a host on the browser process, the return
131 // value is also 0. For other tasks that represent renderers and other child
132 // processes, the return value is whatever unique IDs of their hosts in the
133 // browser process.
134 virtual int GetChildProcessUniqueId(TaskId task_id) const = 0;
135
136 // If the process, in which the task with |task_id| is running, is terminated
137 // this gets the termination status. Currently implemented only for Renderer
138 // processes. The values will only be valid if the process has actually
139 // terminated.
140 virtual void GetTerminationStatus(TaskId task_id,
141 base::TerminationStatus* out_status,
142 int* out_error_code) const = 0;
143
121 // Returns the network usage (in bytes per second) during the current refresh 144 // Returns the network usage (in bytes per second) during the current refresh
122 // cycle for the task with |task_id|. A value of -1 means no valid value is 145 // cycle for the task with |task_id|. A value of -1 means no valid value is
123 // currently available or that task has never been notified of any network 146 // currently available or that task has never been notified of any network
124 // usage. 147 // usage.
125 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0; 148 virtual int64_t GetNetworkUsage(TaskId task_id) const = 0;
126 149
127 // Returns the total network usage (in bytes per second) during the current 150 // Returns the total network usage (in bytes per second) during the current
128 // refresh cycle for the process on which the task with |task_id| is running. 151 // refresh cycle for the process on which the task with |task_id| is running.
129 // This is the sum of all the network usage of the individual tasks (that 152 // This is the sum of all the network usage of the individual tasks (that
130 // can be gotten by the above GetNetworkUsage()). A value of -1 means network 153 // can be gotten by the above GetNetworkUsage()). A value of -1 means network
(...skipping 16 matching lines...) Expand all
147 virtual bool GetWebCacheStats( 170 virtual bool GetWebCacheStats(
148 TaskId task_id, 171 TaskId task_id,
149 blink::WebCache::ResourceTypeStats* stats) const = 0; 172 blink::WebCache::ResourceTypeStats* stats) const = 0;
150 173
151 // Gets the list of task IDs currently tracked by the task manager. The list 174 // Gets the list of task IDs currently tracked by the task manager. The list
152 // will be sorted such that the task representing the browser process is at 175 // will be sorted such that the task representing the browser process is at
153 // the top of the list and the rest of the IDs will be sorted by the process 176 // the top of the list and the rest of the IDs will be sorted by the process
154 // IDs on which the tasks are running, then by the task IDs themselves. 177 // IDs on which the tasks are running, then by the task IDs themselves.
155 virtual const TaskIdList& GetTaskIdsList() const = 0; 178 virtual const TaskIdList& GetTaskIdsList() const = 0;
156 179
180 // Gets the list of task IDs of the tasks that run on the same process as the
181 // task with |task_id|. The returned list will at least include |task_id|.
182 virtual TaskIdList GetIdsOfTasksSharingSameProcess(TaskId task_id) const = 0;
183
157 // Gets the number of task-manager tasks running on the same process on which 184 // Gets the number of task-manager tasks running on the same process on which
158 // the Task with |task_id| is running. 185 // the Task with |task_id| is running.
159 virtual size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const = 0; 186 virtual size_t GetNumberOfTasksOnSameProcess(TaskId task_id) const = 0;
160 187
161 // Returns true if the resource |type| usage calculation is enabled and 188 // Returns true if the resource |type| usage calculation is enabled and
162 // the implementation should refresh its value (this means that at least one 189 // the implementation should refresh its value (this means that at least one
163 // of the observers require this value). False otherwise. 190 // of the observers require this value). False otherwise.
164 bool IsResourceRefreshEnabled(RefreshType type); 191 bool IsResourceRefreshEnabled(RefreshType type) const;
165 192
166 protected: 193 protected:
167 TaskManagerInterface(); 194 TaskManagerInterface();
168 virtual ~TaskManagerInterface(); 195 virtual ~TaskManagerInterface();
169 196
170 // Notifying observers of various events. 197 // Notifying observers of various events.
171 void NotifyObserversOnTaskAdded(TaskId id); 198 void NotifyObserversOnTaskAdded(TaskId id);
172 void NotifyObserversOnTaskToBeRemoved(TaskId id); 199 void NotifyObserversOnTaskToBeRemoved(TaskId id);
173 void NotifyObserversOnRefresh(const TaskIdList& task_ids); 200 void NotifyObserversOnRefresh(const TaskIdList& task_ids);
201 void NotifyObserversOnRefreshWithBackgroundCalculations(
202 const TaskIdList& task_ids);
203 void NotifyObserversOnTaskUnresponsive(TaskId id);
174 204
175 // Refresh all the enabled resources usage of all the available tasks. 205 // Refresh all the enabled resources usage of all the available tasks.
176 virtual void Refresh() = 0; 206 virtual void Refresh() = 0;
177 207
178 // StartUpdating will be called once an observer is added, and StopUpdating 208 // StartUpdating will be called once an observer is added, and StopUpdating
179 // will be called when the last observer is removed. 209 // will be called when the last observer is removed.
180 virtual void StartUpdating() = 0; 210 virtual void StartUpdating() = 0;
181 virtual void StopUpdating() = 0; 211 virtual void StopUpdating() = 0;
182 212
183 // Returns the current refresh time that this task manager is running at. It 213 // Returns the current refresh time that this task manager is running at. It
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 245
216 // The flags containing the enabled resources types calculations. 246 // The flags containing the enabled resources types calculations.
217 int64_t enabled_resources_flags_; 247 int64_t enabled_resources_flags_;
218 248
219 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface); 249 DISALLOW_COPY_AND_ASSIGN(TaskManagerInterface);
220 }; 250 };
221 251
222 } // namespace task_management 252 } // namespace task_management
223 253
224 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_ 254 #endif // CHROME_BROWSER_TASK_MANAGEMENT_TASK_MANAGER_INTERFACE_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_management/sampling/task_manager_impl.cc ('k') | chrome/browser/task_management/task_manager_interface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698