OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/task_management/providers/task.h" |
| 6 |
| 7 namespace task_management { |
| 8 |
| 9 namespace { |
| 10 |
| 11 // The last ID given to the previously created task. |
| 12 int64 g_last_id = 0; |
| 13 |
| 14 } // namespace |
| 15 |
| 16 |
| 17 Task::Task(const base::string16& title, |
| 18 const gfx::ImageSkia& icon, |
| 19 base::ProcessHandle handle) |
| 20 : task_id_(g_last_id++), |
| 21 network_usage_(0), |
| 22 current_byte_count_(0), |
| 23 title_(title), |
| 24 icon_(icon), |
| 25 process_handle_(handle) { |
| 26 } |
| 27 |
| 28 Task::~Task() { |
| 29 } |
| 30 |
| 31 void Task::Refresh(const base::TimeDelta& update_interval) { |
| 32 // TODO(afakhry): Add code here to skip this when network usage refresh has |
| 33 // never been requested. |
| 34 |
| 35 network_usage_ = |
| 36 (current_byte_count_ * base::TimeDelta::FromSeconds(1)) / update_interval; |
| 37 |
| 38 // Reset the current byte count for this task. |
| 39 current_byte_count_ = 0; |
| 40 } |
| 41 |
| 42 void Task::OnNetworkBytesRead(int64 bytes_read) { |
| 43 current_byte_count_ += bytes_read; |
| 44 } |
| 45 |
| 46 base::string16 Task::GetProfileName() const { |
| 47 return base::string16(); |
| 48 } |
| 49 |
| 50 int Task::GetRoutingID() const { |
| 51 return 0; |
| 52 } |
| 53 |
| 54 size_t Task::GetSqliteMemoryUsed() const { |
| 55 return -1U; |
| 56 } |
| 57 |
| 58 size_t Task::GetV8MemoryAllocated() const { |
| 59 return -1U; |
| 60 } |
| 61 |
| 62 size_t Task::GetV8MemoryUsed() const { |
| 63 return -1U; |
| 64 } |
| 65 |
| 66 bool Task::ReportsWebCacheStats() const { |
| 67 return false; |
| 68 } |
| 69 |
| 70 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { |
| 71 return blink::WebCache::ResourceTypeStats(); |
| 72 } |
| 73 |
| 74 } // namespace task_management |
OLD | NEW |