| 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..e72fae902221ca7d72a271b626671d05d32ef5af 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,22 @@ 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 received), as measured over the last refresh cycle.
|
| + int64_t network_usage_rate() const {
|
| + return network_sent_rate_ + network_read_rate_;
|
| + }
|
| +
|
| + // Returns the cumulative number of bytes of network use (sent and received)
|
| + // over the tasks lifetime. It is calculated independently of refreshes and
|
| + // 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 +176,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 this task during the latest
|
| + // 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_;
|
|
|