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

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

Issue 1374283003: Reporting top cpu and memory consumers via rappor on chromeos (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Turn off ResourceReporter on task_management CrOs browser_tests. Created 5 years 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/process/process_handle.h" 9 #include "base/process/process_handle.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 21 matching lines...) Expand all
32 PLUGIN, /* A plugin process. */ 32 PLUGIN, /* A plugin process. */
33 WORKER, /* A web worker process. */ 33 WORKER, /* A web worker process. */
34 NACL, /* A NativeClient loader or broker process. */ 34 NACL, /* A NativeClient loader or broker process. */
35 UTILITY, /* A browser utility process. */ 35 UTILITY, /* A browser utility process. */
36 ZYGOTE, /* A Linux zygote process. */ 36 ZYGOTE, /* A Linux zygote process. */
37 SANDBOX_HELPER, /* A sandbox helper process. */ 37 SANDBOX_HELPER, /* A sandbox helper process. */
38 GPU, /* A graphics process. */ 38 GPU, /* A graphics process. */
39 }; 39 };
40 40
41 // Create a task with the given |title| and the given favicon |icon|. This 41 // Create a task with the given |title| and the given favicon |icon|. This
42 // task runs on a process whose handle is |handle|. 42 // task runs on a process whose handle is |handle|. |rappor_sample| is the
43 // name of the sample to be recorded if this task needs to be reported by
44 // Rappor.
43 Task(const base::string16& title, 45 Task(const base::string16& title,
46 const std::string& rappor_sample,
44 const gfx::ImageSkia* icon, 47 const gfx::ImageSkia* icon,
45 base::ProcessHandle handle); 48 base::ProcessHandle handle);
46 virtual ~Task(); 49 virtual ~Task();
47 50
48 // Gets the name of the given |profile| from the ProfileInfoCache. 51 // Gets the name of the given |profile| from the ProfileInfoCache.
49 static base::string16 GetProfileNameFromProfile(Profile* profile); 52 static base::string16 GetProfileNameFromProfile(Profile* profile);
50 53
51 // Activates this TaskManager's task by bringing its container to the front 54 // Activates this TaskManager's task by bringing its container to the front
52 // (if possible). 55 // (if possible).
53 virtual void Activate(); 56 virtual void Activate();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // them if it does. 97 // them if it does.
95 virtual bool ReportsWebCacheStats() const; 98 virtual bool ReportsWebCacheStats() const;
96 virtual blink::WebCache::ResourceTypeStats GetWebCacheStats() const; 99 virtual blink::WebCache::ResourceTypeStats GetWebCacheStats() const;
97 100
98 // Checking whether the task reports network usage. 101 // Checking whether the task reports network usage.
99 bool ReportsNetworkUsage() const; 102 bool ReportsNetworkUsage() const;
100 103
101 int64 task_id() const { return task_id_; } 104 int64 task_id() const { return task_id_; }
102 int64 network_usage() const { return network_usage_; } 105 int64 network_usage() const { return network_usage_; }
103 const base::string16& title() const { return title_; } 106 const base::string16& title() const { return title_; }
107 const std::string& rappor_sample_name() const { return rappor_sample_name_; }
104 const gfx::ImageSkia& icon() const { return icon_; } 108 const gfx::ImageSkia& icon() const { return icon_; }
105 const base::ProcessHandle& process_handle() const { return process_handle_; } 109 const base::ProcessHandle& process_handle() const { return process_handle_; }
106 const base::ProcessId& process_id() const { return process_id_; } 110 const base::ProcessId& process_id() const { return process_id_; }
107 111
108 protected: 112 protected:
109 void set_title(const base::string16& new_title) { title_ = new_title; } 113 void set_title(const base::string16& new_title) { title_ = new_title; }
114 void set_rappor_sample_name(const std::string& sample) {
115 rappor_sample_name_ = sample;
116 }
110 void set_icon(const gfx::ImageSkia& new_icon) { icon_ = new_icon; } 117 void set_icon(const gfx::ImageSkia& new_icon) { icon_ = new_icon; }
111 118
112 private: 119 private:
113 // The unique ID of this task. 120 // The unique ID of this task.
114 const int64 task_id_; 121 const int64 task_id_;
115 122
116 // The task's network usage in the current refresh cycle measured in bytes per 123 // The task's network usage in the current refresh cycle measured in bytes per
117 // second. A value of -1 means this task doesn't report network usage data. 124 // second. A value of -1 means this task doesn't report network usage data.
118 int64 network_usage_; 125 int64 network_usage_;
119 126
120 // The current network bytes received by this task during the current refresh 127 // The current network bytes received by this task during the current refresh
121 // cycle. A value of -1 means this task has never been notified of any network 128 // cycle. A value of -1 means this task has never been notified of any network
122 // usage. 129 // usage.
123 int64 current_byte_count_; 130 int64 current_byte_count_;
124 131
125 // The title of the task. 132 // The title of the task.
126 base::string16 title_; 133 base::string16 title_;
127 134
135 // The name of the sample representing this task when a Rappor sample needs to
136 // be recorded for it.
137 std::string rappor_sample_name_;
138
128 // The favicon. 139 // The favicon.
129 gfx::ImageSkia icon_; 140 gfx::ImageSkia icon_;
130 141
131 // The handle of the process on which this task is running. 142 // The handle of the process on which this task is running.
132 const base::ProcessHandle process_handle_; 143 const base::ProcessHandle process_handle_;
133 144
134 // The PID of the process on which this task is running. 145 // The PID of the process on which this task is running.
135 const base::ProcessId process_id_; 146 const base::ProcessId process_id_;
136 147
137 DISALLOW_COPY_AND_ASSIGN(Task); 148 DISALLOW_COPY_AND_ASSIGN(Task);
138 }; 149 };
139 150
140 } // namespace task_management 151 } // namespace task_management
141 152
142 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_ 153 #endif // CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_TASK_H_
OLDNEW
« no previous file with comments | « chrome/browser/task_management/providers/child_process_task.cc ('k') | chrome/browser/task_management/providers/task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698