Chromium Code Reviews| Index: chrome/browser/task_manager/providers/task.h |
| diff --git a/chrome/browser/task_manager/providers/task.h b/chrome/browser/task_manager/providers/task.h |
| index a3e91ceeeb21cf116c49c285f3bac1ca7f0957a6..4ddeb80cc744bab681733be8ee07563701c4c58f 100644 |
| --- a/chrome/browser/task_manager/providers/task.h |
| +++ b/chrome/browser/task_manager/providers/task.h |
| @@ -85,9 +85,14 @@ class Task { |
| // Will receive this notification through the task manager from |
| // |ChromeNetworkDelegate::OnNetworkBytesReceived()|. The task will add to the |
| - // |current_byte_count_| in this refresh cycle. |
| + // |cummulative_read_bytes_|. |
| void OnNetworkBytesRead(int64_t bytes_read); |
| + // Will receive this notification through the task manager from |
| + // |ChromeNetworkDelegate::OnNetworkBytesSent()|. The task will add to the |
| + // |cummulative_sent_bytes_| in this refresh cycle. |
| + void OnNetworkBytesSent(int64_t bytes_sent); |
| + |
| // Returns the task type. |
| virtual Type GetType() const = 0; |
| @@ -138,11 +143,25 @@ class Task { |
| // Returns the keep-alive counter if the Task is an event page, -1 otherwise. |
| virtual int GetKeepaliveCount() const; |
| - // Checking whether the task reports network usage. |
| - bool ReportsNetworkUsage() const; |
| - |
| int64_t task_id() const { return task_id_; } |
| - int64_t network_usage() const { return network_usage_; } |
| + |
| + // Returns the instantaneous rate, in bytes per second, of network usage |
| + // (sent and recieved), as measured over the last refresh cycle. |
|
ncarter (slow)
2017/06/16 22:28:30
recieved -> received
(I always get this wrong)
cburn
2017/06/19 22:07:08
Done.
|
| + int64_t network_usage_rate() const { |
| + // This needs the |&& ! ReportNetworkUsage()| because it should only report |
| + // -1 When there hasnt been any traffic. This is only true when both rates |
| + // are 0 and ReportsNetworkUsage is also false. |
|
ncarter (slow)
2017/06/16 22:28:30
Delete these three comment lines.
cburn
2017/06/19 22:07:08
Done.
|
| + return network_sent_rate_ + network_read_rate_; |
| + } |
| + |
| + // Returns the cumulative number of bytes of network use (sent and recieved) |
| + // over the tasks lifetime. It is calculated independantly of refreshes and |
|
ncarter (slow)
2017/06/16 22:28:30
tasks -> task's
independantly -> independently
cburn
2017/06/19 22:07:08
Done. I also have sublime doing spell checking on
|
| + // is based on the current |cumulative_bytes_read_| and |
| + // |cumulative_bytes_sent_|. |
| + int64_t cumulative_network_usage() const { |
| + return cumulative_bytes_sent_ + cumulative_bytes_read_; |
| + } |
| + |
| const base::string16& title() const { return title_; } |
| const std::string& rappor_sample_name() const { return rappor_sample_name_; } |
| const gfx::ImageSkia& icon() const { return icon_; } |
| @@ -160,14 +179,31 @@ class Task { |
| // The unique ID of this task. |
| const int64_t task_id_; |
| - // The task's network usage in the current refresh cycle measured in bytes per |
| - // second. A value of -1 means this task doesn't report network usage data. |
| - int64_t network_usage_; |
| + // The sum of all bytes that have been uploaded from this task calculated at |
| + // the last refresh. |
| + int64_t last_refresh_cumulative_bytes_sent_; |
| + |
| + // The sum of all bytes that have been downloaded from this task calculated |
| + // at the last refresh. |
| + int64_t last_refresh_cumulative_bytes_read_; |
| + |
| + // A continuously updating sum of all bytes that have been uploaded from this |
| + // task. It is assigned to |last_refresh_cumulative_bytes_sent_| at the end |
| + // of a refresh. |
| + int64_t cumulative_bytes_sent_; |
| + |
| + // A continuously updating sum of all bytes that have been downloaded from |
| + // this task. It is assigned to |last_refresh_cumulative_bytes_sent_| at the |
| + // end of a refresh. |
| + int64_t cumulative_bytes_read_; |
| - // The current network bytes received by this task during the current refresh |
| - // cycle. A value of -1 means this task has never been notified of any network |
| - // usage. |
| - int64_t current_byte_count_; |
| + // The upload rate (in bytes per second) for htis task during the latest |
|
ncarter (slow)
2017/06/16 22:28:30
htis -> this
cburn
2017/06/19 22:07:08
Done.
|
| + // refresh. |
| + int64_t network_sent_rate_; |
| + |
| + // The download rate (in bytes per second) for this task during the latest |
| + // refresh. |
| + int64_t network_read_rate_; |
| // The title of the task. |
| base::string16 title_; |