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

Side by Side Diff: chrome/browser/task_manager/providers/task.h

Issue 2961423002: [TaskManager] Allow a Task to mutate its PID after creation (Closed)
Patch Set: afakhry's fixes Created 3 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/task_manager/providers/task.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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
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/08/01 17:25:35 Nit: Looking at this comment again, I think it wou
ncarter (slow) 2017/08/01 23:07:09 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
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_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/task_manager/providers/task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698