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

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

Issue 2028753002: Make Task Manager sort more meaningful (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a default argument instead of a second ctor. Created 4 years, 6 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_PROVIDERS_TASK_H_ 5 #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_ 6 #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 10 matching lines...) Expand all
21 21
22 namespace task_management { 22 namespace task_management {
23 23
24 // Defines a task that corresponds to a tab, an app, an extension, ... etc. It 24 // 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 25 // 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 26 // same process, in which case they're grouped together in the task manager
27 // table. See |task_management::TaskGroup| which represents a process possibly 27 // table. See |task_management::TaskGroup| which represents a process possibly
28 // shared by multiple tasks. 28 // shared by multiple tasks.
29 class Task { 29 class Task {
30 public: 30 public:
31 // Note that the declaration order here determines the default sort order
32 // in the task manager.
31 enum Type { 33 enum Type {
32 UNKNOWN = 0, 34 UNKNOWN = 0,
33 BROWSER, /* The main browser process. */ 35
34 RENDERER, /* A normal WebContents renderer process. */ 36 /* Singleton processes first that don't belong to a particular tab. */
35 EXTENSION, /* An extension or app process. */ 37 BROWSER, /* The main browser process. */
38 GPU, /* A graphics process. */
39 ARC, /* An ARC process. */
40 ZYGOTE, /* A Linux zygote process. */
41 UTILITY, /* A browser utility process. */
42
43 /* Per-Tab processes next. */
44 RENDERER, /* A normal WebContents renderer process. */
45 EXTENSION, /* An extension or app process. */
46
47 /* Plugin processes last.*/
36 GUEST, /* A browser plugin guest process. */ 48 GUEST, /* A browser plugin guest process. */
37 PLUGIN, /* A plugin process. */ 49 PLUGIN, /* A plugin process. */
38 WORKER, /* A web worker process. */ 50 WORKER, /* A web worker process. */
39 NACL, /* A NativeClient loader or broker process. */ 51 NACL, /* A NativeClient loader or broker process. */
40 UTILITY, /* A browser utility process. */
41 ZYGOTE, /* A Linux zygote process. */
42 SANDBOX_HELPER, /* A sandbox helper process. */ 52 SANDBOX_HELPER, /* A sandbox helper process. */
43 GPU, /* A graphics process. */
44 ARC, /* An ARC process. */
45 }; 53 };
46 54
47 // Create a task with the given |title| and the given favicon |icon|. This 55 // Create a task with the given |title| and the given favicon |icon|. This
48 // task runs on a process whose handle is |handle|. |rappor_sample| is the 56 // task runs on a process whose handle is |handle|. |rappor_sample| is the
49 // name of the sample to be recorded if this task needs to be reported by 57 // name of the sample to be recorded if this task needs to be reported by
50 // Rappor. 58 // Rappor. If |process_id| is not supplied, it will be determined by |handle|.
51 Task(const base::string16& title, 59 Task(const base::string16& title,
52 const std::string& rappor_sample, 60 const std::string& rappor_sample,
53 const gfx::ImageSkia* icon, 61 const gfx::ImageSkia* icon,
54 base::ProcessHandle handle); 62 base::ProcessHandle handle,
63 base::ProcessId process_id = base::kNullProcessId);
55 virtual ~Task(); 64 virtual ~Task();
56 65
57 // Gets the name of the given |profile| from the ProfileAttributesStorage. 66 // Gets the name of the given |profile| from the ProfileAttributesStorage.
58 static base::string16 GetProfileNameFromProfile(Profile* profile); 67 static base::string16 GetProfileNameFromProfile(Profile* profile);
59 68
60 // Activates this TaskManager's task by bringing its container to the front 69 // Activates this TaskManager's task by bringing its container to the front
61 // (if possible). 70 // (if possible).
62 virtual void Activate(); 71 virtual void Activate();
63 72
64 // Kills this task. 73 // Kills this task.
(...skipping 27 matching lines...) Expand all
92 int* out_error_code) const; 101 int* out_error_code) const;
93 102
94 // The name of the profile owning this task. 103 // The name of the profile owning this task.
95 virtual base::string16 GetProfileName() const; 104 virtual base::string16 GetProfileName() const;
96 105
97 // Returns the unique ID of the tab if this task represents a renderer 106 // Returns the unique ID of the tab if this task represents a renderer
98 // WebContents used for a tab. Returns -1 if this task does not represent 107 // WebContents used for a tab. Returns -1 if this task does not represent
99 // a renderer, or a contents of a tab. 108 // a renderer, or a contents of a tab.
100 virtual int GetTabId() const; 109 virtual int GetTabId() const;
101 110
111 // For Tasks that represent a subactivity of some other task (e.g. a plugin
112 // embedded in a page), this returns the Task representing the parent
113 // activity.
114 virtual const Task* GetParentTask() const;
115
102 // Getting the Sqlite used memory (in bytes). Not all tasks reports Sqlite 116 // Getting the Sqlite used memory (in bytes). Not all tasks reports Sqlite
103 // memory, in this case a default invalid value of -1 will be returned. 117 // memory, in this case a default invalid value of -1 will be returned.
104 // Check for whether the task reports it or not first. 118 // Check for whether the task reports it or not first.
105 bool ReportsSqliteMemory() const; 119 bool ReportsSqliteMemory() const;
106 virtual int64_t GetSqliteMemoryUsed() const; 120 virtual int64_t GetSqliteMemoryUsed() const;
107 121
108 // Getting the allocated and used V8 memory (in bytes). Not all tasks reports 122 // Getting the allocated and used V8 memory (in bytes). Not all tasks reports
109 // V8 memory, in this case a default invalid value of -1 will be returned. 123 // V8 memory, in this case a default invalid value of -1 will be returned.
110 // Check for whether the task reports it or not first. 124 // Check for whether the task reports it or not first.
111 bool ReportsV8Memory() const; 125 bool ReportsV8Memory() const;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 177
164 // The PID of the process on which this task is running. 178 // The PID of the process on which this task is running.
165 const base::ProcessId process_id_; 179 const base::ProcessId process_id_;
166 180
167 DISALLOW_COPY_AND_ASSIGN(Task); 181 DISALLOW_COPY_AND_ASSIGN(Task);
168 }; 182 };
169 183
170 } // namespace task_management 184 } // namespace task_management
171 185
172 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_ 186 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698