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 // ---------------------------------------------------------------------- |
| 10 // Public Members: |
| 11 // ---------------------------------------------------------------------- |
| 12 |
| 13 Task::Task(const base::string16& title, |
| 14 const gfx::ImageSkia& icon, |
| 15 base::ProcessHandle handle) |
| 16 : task_id_(last_id_++), |
| 17 network_usage_(0), |
| 18 current_byte_count_(0), |
| 19 title_(title), |
| 20 icon_(icon), |
| 21 process_handle_(handle), |
| 22 is_first_in_group_(true) { |
| 23 } |
| 24 |
| 25 Task::~Task() { |
| 26 } |
| 27 |
| 28 base::string16 Task::GetProfileName() const { |
| 29 return base::string16(); |
| 30 } |
| 31 |
| 32 int Task::GetRoutingID() const { |
| 33 return 0; |
| 34 } |
| 35 |
| 36 size_t Task::GetSqliteMemoryUsed() const { |
| 37 return -1U; |
| 38 } |
| 39 |
| 40 size_t Task::GetV8MemoryAllocated() const { |
| 41 return -1U; |
| 42 } |
| 43 |
| 44 size_t Task::GetV8MemoryUsed() const { |
| 45 return -1U; |
| 46 } |
| 47 |
| 48 bool Task::ReportsWebCacheStats() const { |
| 49 return false; |
| 50 } |
| 51 |
| 52 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { |
| 53 return blink::WebCache::ResourceTypeStats(); |
| 54 } |
| 55 |
| 56 void Task::Refresh(const base::TimeDelta& update_duration) { |
| 57 // TODO(afakhry): Add code here to skip this when network usage refresh has |
| 58 // never been requested. |
| 59 |
| 60 int64 update_time_secs = update_duration.InSeconds(); |
| 61 DCHECK(update_time_secs != 0); |
| 62 network_usage_ = current_byte_count_ / update_time_secs; |
| 63 |
| 64 // Reset the current byte count for this task. |
| 65 current_byte_count_ = 0; |
| 66 } |
| 67 |
| 68 void Task::OnBytesRead(int64 bytes_read) { |
| 69 current_byte_count_ += bytes_read; |
| 70 } |
| 71 |
| 72 // ---------------------------------------------------------------------- |
| 73 // Private Members: |
| 74 // ---------------------------------------------------------------------- |
| 75 |
| 76 // static |
| 77 int64 Task::last_id_ = 0; |
| 78 |
| 79 } // namespace task_management |
OLD | NEW |