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_MANAGER_PROVIDERS_TASK_H_ | 5 #ifndef CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ |
6 #define CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ | 6 #define CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/process/kill.h" | 13 #include "base/process/kill.h" |
14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "third_party/WebKit/public/platform/WebCache.h" | 17 #include "third_party/WebKit/public/platform/WebCache.h" |
18 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
19 | 19 |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace task_manager { | 22 namespace task_manager { |
23 | 23 |
24 class TaskProviderObserver; | |
25 | |
24 // Defines a task that corresponds to a tab, an app, an extension, ... etc. It | 26 // Defines a task that corresponds to a tab, an app, an extension, ... etc. It |
25 // represents one row in the task manager table. Multiple tasks can share the | 27 // represents one row in the task manager table. Multiple tasks can share the |
26 // same process, in which case they're grouped together in the task manager | 28 // same process, in which case they're grouped together in the task manager |
27 // table. See |task_manager::TaskGroup| which represents a process possibly | 29 // table. See |task_manager::TaskGroup| which represents a process possibly |
28 // shared by multiple tasks. | 30 // shared by multiple tasks. |
29 class Task { | 31 class Task { |
30 public: | 32 public: |
31 // Note that the declaration order here determines the default sort order | 33 // Note that the declaration order here determines the default sort order |
32 // in the task manager. | 34 // in the task manager. |
33 enum Type { | 35 enum Type { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // Kills this task. | 78 // Kills this task. |
77 virtual void Kill(); | 79 virtual void Kill(); |
78 | 80 |
79 // Will be called to let the task refresh itself between refresh cycles. | 81 // Will be called to let the task refresh itself between refresh cycles. |
80 // |update_interval| is the time since the last task manager refresh. | 82 // |update_interval| is the time since the last task manager refresh. |
81 // the |refresh_flags| indicate which resources should be calculated on each | 83 // the |refresh_flags| indicate which resources should be calculated on each |
82 // refresh. | 84 // refresh. |
83 virtual void Refresh(const base::TimeDelta& update_interval, | 85 virtual void Refresh(const base::TimeDelta& update_interval, |
84 int64_t refresh_flags); | 86 int64_t refresh_flags); |
85 | 87 |
88 // Temporarily remove a task, change its process id, and then re-add it. | |
afakhry
2017/07/10 17:27:53
Nit: For consistency, process id => process ID.
ncarter (slow)
2017/07/31 22:30:29
Done.
| |
89 void UpdateProcessInfo(base::ProcessHandle handle, | |
90 base::ProcessId process_id, | |
91 TaskProviderObserver* observer); | |
92 | |
86 // Will receive this notification through the task manager from | 93 // Will receive this notification through the task manager from |
87 // |ChromeNetworkDelegate::OnNetworkBytesReceived()|. The task will add to the | 94 // |ChromeNetworkDelegate::OnNetworkBytesReceived()|. The task will add to the |
88 // |current_byte_count_| in this refresh cycle. | 95 // |current_byte_count_| in this refresh cycle. |
89 void OnNetworkBytesRead(int64_t bytes_read); | 96 void OnNetworkBytesRead(int64_t bytes_read); |
90 | 97 |
91 // Returns the task type. | 98 // Returns the task type. |
92 virtual Type GetType() const = 0; | 99 virtual Type GetType() const = 0; |
93 | 100 |
94 // This is the unique ID of the BrowserChildProcessHost/RenderProcessHost. It | 101 // This is the unique ID of the BrowserChildProcessHost/RenderProcessHost. It |
95 // is not the PID nor the handle of the process. | 102 // is not the PID nor the handle of the process. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 base::string16 title_; | 180 base::string16 title_; |
174 | 181 |
175 // The name of the sample representing this task when a Rappor sample needs to | 182 // The name of the sample representing this task when a Rappor sample needs to |
176 // be recorded for it. | 183 // be recorded for it. |
177 std::string rappor_sample_name_; | 184 std::string rappor_sample_name_; |
178 | 185 |
179 // The favicon. | 186 // The favicon. |
180 gfx::ImageSkia icon_; | 187 gfx::ImageSkia icon_; |
181 | 188 |
182 // The handle of the process on which this task is running. | 189 // The handle of the process on which this task is running. |
183 const base::ProcessHandle process_handle_; | 190 base::ProcessHandle process_handle_; |
184 | 191 |
185 // The PID of the process on which this task is running. | 192 // The PID of the process on which this task is running. |
186 const base::ProcessId process_id_; | 193 base::ProcessId process_id_; |
187 | 194 |
188 DISALLOW_COPY_AND_ASSIGN(Task); | 195 DISALLOW_COPY_AND_ASSIGN(Task); |
189 }; | 196 }; |
190 | 197 |
191 } // namespace task_manager | 198 } // namespace task_manager |
192 | 199 |
193 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ | 200 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ |
OLD | NEW |