| Index: chrome/browser/task_management/providers/task.cc
|
| diff --git a/chrome/browser/task_management/providers/task.cc b/chrome/browser/task_management/providers/task.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8e49e36b4bb56de5f0c588e3e9a42e0fffc85583
|
| --- /dev/null
|
| +++ b/chrome/browser/task_management/providers/task.cc
|
| @@ -0,0 +1,79 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/task_management/providers/task.h"
|
| +
|
| +namespace task_management {
|
| +
|
| +// ----------------------------------------------------------------------
|
| +// Public Members:
|
| +// ----------------------------------------------------------------------
|
| +
|
| +Task::Task(const base::string16& title,
|
| + const gfx::ImageSkia& icon,
|
| + base::ProcessHandle handle)
|
| + : task_id_(last_id_++),
|
| + network_usage_(0),
|
| + current_byte_count_(0),
|
| + title_(title),
|
| + icon_(icon),
|
| + process_handle_(handle),
|
| + is_first_in_group_(true) {
|
| +}
|
| +
|
| +Task::~Task() {
|
| +}
|
| +
|
| +base::string16 Task::GetProfileName() const {
|
| + return base::string16();
|
| +}
|
| +
|
| +int Task::GetRoutingID() const {
|
| + return 0;
|
| +}
|
| +
|
| +size_t Task::GetSqliteMemoryUsed() const {
|
| + return -1U;
|
| +}
|
| +
|
| +size_t Task::GetV8MemoryAllocated() const {
|
| + return -1U;
|
| +}
|
| +
|
| +size_t Task::GetV8MemoryUsed() const {
|
| + return -1U;
|
| +}
|
| +
|
| +bool Task::ReportsWebCacheStats() const {
|
| + return false;
|
| +}
|
| +
|
| +blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const {
|
| + return blink::WebCache::ResourceTypeStats();
|
| +}
|
| +
|
| +void Task::Refresh(const base::TimeDelta& update_duration) {
|
| + // TODO(afakhry): Add code here to skip this when network usage refresh has
|
| + // never been requested.
|
| +
|
| + int64 update_time_secs = update_duration.InSeconds();
|
| + DCHECK(update_time_secs != 0);
|
| + network_usage_ = current_byte_count_ / update_time_secs;
|
| +
|
| + // Reset the current byte count for this task.
|
| + current_byte_count_ = 0;
|
| +}
|
| +
|
| +void Task::OnBytesRead(int64 bytes_read) {
|
| + current_byte_count_ += bytes_read;
|
| +}
|
| +
|
| +// ----------------------------------------------------------------------
|
| +// Private Members:
|
| +// ----------------------------------------------------------------------
|
| +
|
| +// static
|
| +int64 Task::last_id_ = 0;
|
| +
|
| +} // namespace task_management
|
|
|