| 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_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 Loading... |
| 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 // Returns if the task should be killable from the Task Manager UI. | 73 // Returns if the task should be killable from the Task Manager UI. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 95 int* out_error_code) const; | 104 int* out_error_code) const; |
| 96 | 105 |
| 97 // The name of the profile owning this task. | 106 // The name of the profile owning this task. |
| 98 virtual base::string16 GetProfileName() const; | 107 virtual base::string16 GetProfileName() const; |
| 99 | 108 |
| 100 // Returns the unique ID of the tab if this task represents a renderer | 109 // Returns the unique ID of the tab if this task represents a renderer |
| 101 // WebContents used for a tab. Returns -1 if this task does not represent | 110 // WebContents used for a tab. Returns -1 if this task does not represent |
| 102 // a renderer, or a contents of a tab. | 111 // a renderer, or a contents of a tab. |
| 103 virtual int GetTabId() const; | 112 virtual int GetTabId() const; |
| 104 | 113 |
| 114 // For Tasks that represent a subactivity of some other task (e.g. a plugin |
| 115 // embedded in a page), this returns the Task representing the parent |
| 116 // activity. |
| 117 bool HasParentTask() const; |
| 118 virtual const Task* GetParentTask() const; |
| 119 |
| 105 // Getting the Sqlite used memory (in bytes). Not all tasks reports Sqlite | 120 // Getting the Sqlite used memory (in bytes). Not all tasks reports Sqlite |
| 106 // memory, in this case a default invalid value of -1 will be returned. | 121 // memory, in this case a default invalid value of -1 will be returned. |
| 107 // Check for whether the task reports it or not first. | 122 // Check for whether the task reports it or not first. |
| 108 bool ReportsSqliteMemory() const; | 123 bool ReportsSqliteMemory() const; |
| 109 virtual int64_t GetSqliteMemoryUsed() const; | 124 virtual int64_t GetSqliteMemoryUsed() const; |
| 110 | 125 |
| 111 // Getting the allocated and used V8 memory (in bytes). Not all tasks reports | 126 // Getting the allocated and used V8 memory (in bytes). Not all tasks reports |
| 112 // V8 memory, in this case a default invalid value of -1 will be returned. | 127 // V8 memory, in this case a default invalid value of -1 will be returned. |
| 113 // Check for whether the task reports it or not first. | 128 // Check for whether the task reports it or not first. |
| 114 bool ReportsV8Memory() const; | 129 bool ReportsV8Memory() const; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 181 |
| 167 // The PID of the process on which this task is running. | 182 // The PID of the process on which this task is running. |
| 168 const base::ProcessId process_id_; | 183 const base::ProcessId process_id_; |
| 169 | 184 |
| 170 DISALLOW_COPY_AND_ASSIGN(Task); | 185 DISALLOW_COPY_AND_ASSIGN(Task); |
| 171 }; | 186 }; |
| 172 | 187 |
| 173 } // namespace task_management | 188 } // namespace task_management |
| 174 | 189 |
| 175 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_ | 190 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_ |
| OLD | NEW |