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

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

Issue 2905403002: plumb network upload into the task manager (Closed)
Patch Set: fixed negative byte totals Created 3 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_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>
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 // Will be called to let the task refresh itself between refresh cycles. 79 // Will be called to let the task refresh itself between refresh cycles.
80 // |update_interval| is the time since the last task manager refresh. 80 // |update_interval| is the time since the last task manager refresh.
81 // the |refresh_flags| indicate which resources should be calculated on each 81 // the |refresh_flags| indicate which resources should be calculated on each
82 // refresh. 82 // refresh.
83 virtual void Refresh(const base::TimeDelta& update_interval, 83 virtual void Refresh(const base::TimeDelta& update_interval,
84 int64_t refresh_flags); 84 int64_t refresh_flags);
85 85
86 // Will receive this notification through the task manager from 86 // Will receive this notification through the task manager from
87 // |ChromeNetworkDelegate::OnNetworkBytesReceived()|. The task will add to the 87 // |ChromeNetworkDelegate::OnNetworkBytesReceived()|. The task will add to the
88 // |current_byte_count_| in this refresh cycle. 88 // |current_read_byte_count_| in this refresh cycle.
89 void OnNetworkBytesRead(int64_t bytes_read); 89 void OnNetworkBytesRead(int64_t bytes_read);
90 90
91 // Will receive this notification through the task manager from
92 // |ChromeNetworkDelegate::OnNetworkBytesSent()|. The task will add to the
93 // |current_sent_byte_count_| in this refresh cycle.
94 void OnNetworkBytesSent(int64_t bytes_sent);
95
91 // Returns the task type. 96 // Returns the task type.
92 virtual Type GetType() const = 0; 97 virtual Type GetType() const = 0;
93 98
94 // This is the unique ID of the BrowserChildProcessHost/RenderProcessHost. It 99 // This is the unique ID of the BrowserChildProcessHost/RenderProcessHost. It
95 // is not the PID nor the handle of the process. 100 // is not the PID nor the handle of the process.
96 // For a task that represents the browser process, the return value is 0. For 101 // For a task that represents the browser process, the return value is 0. For
97 // other tasks that represent renderers and other child processes, the return 102 // other tasks that represent renderers and other child processes, the return
98 // value is whatever unique IDs of their hosts in the browser process. 103 // value is whatever unique IDs of their hosts in the browser process.
99 virtual int GetChildProcessUniqueID() const = 0; 104 virtual int GetChildProcessUniqueID() const = 0;
100 105
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 virtual blink::WebCache::ResourceTypeStats GetWebCacheStats() const; 141 virtual blink::WebCache::ResourceTypeStats GetWebCacheStats() const;
137 142
138 // Returns the keep-alive counter if the Task is an event page, -1 otherwise. 143 // Returns the keep-alive counter if the Task is an event page, -1 otherwise.
139 virtual int GetKeepaliveCount() const; 144 virtual int GetKeepaliveCount() const;
140 145
141 // Checking whether the task reports network usage. 146 // Checking whether the task reports network usage.
142 bool ReportsNetworkUsage() const; 147 bool ReportsNetworkUsage() const;
143 148
144 int64_t task_id() const { return task_id_; } 149 int64_t task_id() const { return task_id_; }
145 int64_t network_usage() const { return network_usage_; } 150 int64_t network_usage() const { return network_usage_; }
151 int64_t total_network_usage() const { return total_network_usage_; }
146 const base::string16& title() const { return title_; } 152 const base::string16& title() const { return title_; }
147 const std::string& rappor_sample_name() const { return rappor_sample_name_; } 153 const std::string& rappor_sample_name() const { return rappor_sample_name_; }
148 const gfx::ImageSkia& icon() const { return icon_; } 154 const gfx::ImageSkia& icon() const { return icon_; }
149 const base::ProcessHandle& process_handle() const { return process_handle_; } 155 const base::ProcessHandle& process_handle() const { return process_handle_; }
150 const base::ProcessId& process_id() const { return process_id_; } 156 const base::ProcessId& process_id() const { return process_id_; }
151 157
152 protected: 158 protected:
153 void set_title(const base::string16& new_title) { title_ = new_title; } 159 void set_title(const base::string16& new_title) { title_ = new_title; }
154 void set_rappor_sample_name(const std::string& sample) { 160 void set_rappor_sample_name(const std::string& sample) {
155 rappor_sample_name_ = sample; 161 rappor_sample_name_ = sample;
156 } 162 }
157 void set_icon(const gfx::ImageSkia& new_icon) { icon_ = new_icon; } 163 void set_icon(const gfx::ImageSkia& new_icon) { icon_ = new_icon; }
158 164
159 private: 165 private:
160 // The unique ID of this task. 166 // The unique ID of this task.
161 const int64_t task_id_; 167 const int64_t task_id_;
162 168
163 // The task's network usage in the current refresh cycle measured in bytes per 169 // The task's network usage in the current refresh cycle measured in bytes per
164 // second. A value of -1 means this task doesn't report network usage data. 170 // second. A value of -1 means this task doesn't report network usage data.
165 int64_t network_usage_; 171 int64_t network_usage_;
166 172
173 // The task's total network usage for its lifetime measured in bytes
ncarter (slow) 2017/06/08 23:37:18 Extra space before 'total'
cburn 2017/06/14 18:04:37 Done.
174 // A value of -1 means this task doesn't report network usage data.
175 int64_t total_network_usage_;
176
177 // The task's network usage for reading data in the current refresh cycle
178 // measured in bytes per second. A value of -1 means this task doesn't report
179 // network usage data.
180 int64_t network_read_usage_;
181
182 // The task's network usage for sending data in the current refresh cycle
183 // measured in bytes per second. A value of -1 means this task doesn't report
184 // network usage data.
185 int64_t network_sent_usage_;
186
187 // TODO: cburn clearn this up
188 // The current network bytes sent and received by this task during the current
189 // refresh cycle. A value of -1 means this task has never been notified of any
190 // network usage.
191 // int64_t current_byte_count_;
192
167 // The current network bytes received by this task during the current refresh 193 // The current network bytes received by this task during the current refresh
168 // cycle. A value of -1 means this task has never been notified of any network 194 // cycle. A value of -1 means this task has never been notified of any network
169 // usage. 195 // usage.
170 int64_t current_byte_count_; 196 int64_t current_read_byte_count_;
197
198 // The current network bytes sent by this task during the current refresh
199 // cycle. A value of -1 means this task has never been notified of any network
200 // usage.
201 int64_t current_sent_byte_count_;
202
203 // The current total number of bytes read by this task. A value of -1 means
204 // that this task has never read any bytes.
205 int64_t total_read_byte_count_;
206
207 // The current total number of bytes sent by this task. A value of -1 means
208 // that this task has never sent any bytes.
209 int64_t total_sent_byte_count_;
ncarter (slow) 2017/06/08 23:37:18 Let's try to reduce the number of fields here to a
cburn 2017/06/14 18:04:37 Done.
171 210
172 // The title of the task. 211 // The title of the task.
173 base::string16 title_; 212 base::string16 title_;
174 213
175 // The name of the sample representing this task when a Rappor sample needs to 214 // The name of the sample representing this task when a Rappor sample needs to
176 // be recorded for it. 215 // be recorded for it.
177 std::string rappor_sample_name_; 216 std::string rappor_sample_name_;
178 217
179 // The favicon. 218 // The favicon.
180 gfx::ImageSkia icon_; 219 gfx::ImageSkia icon_;
181 220
182 // The handle of the process on which this task is running. 221 // The handle of the process on which this task is running.
183 const base::ProcessHandle process_handle_; 222 const base::ProcessHandle process_handle_;
184 223
185 // The PID of the process on which this task is running. 224 // The PID of the process on which this task is running.
186 const base::ProcessId process_id_; 225 const base::ProcessId process_id_;
187 226
188 DISALLOW_COPY_AND_ASSIGN(Task); 227 DISALLOW_COPY_AND_ASSIGN(Task);
189 }; 228 };
190 229
191 } // namespace task_manager 230 } // namespace task_manager
192 231
193 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_ 232 #endif // CHROME_BROWSER_TASK_MANAGER_PROVIDERS_TASK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698