Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: chrome/browser/task_management/providers/task.cc

Issue 1038033002: New Task Manager - Phase 1.1: Implement Browser Process Task Providing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: As agreed, made network_usage_ calculation accurate. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 Task::Task(const base::string16& title,
10 const gfx::ImageSkia& icon,
11 base::ProcessHandle handle)
12 : task_id_(last_id_++),
13 network_usage_(0),
14 current_byte_count_(0),
15 title_(title),
16 icon_(icon),
17 process_handle_(handle) {
18 }
19
20 Task::~Task() {
21 }
22
23 base::string16 Task::GetProfileName() const {
24 return base::string16();
25 }
26
27 int Task::GetRoutingID() const {
28 return 0;
29 }
30
31 size_t Task::GetSqliteMemoryUsed() const {
32 return -1U;
33 }
34
35 size_t Task::GetV8MemoryAllocated() const {
36 return -1U;
37 }
38
39 size_t Task::GetV8MemoryUsed() const {
40 return -1U;
41 }
42
43 bool Task::ReportsWebCacheStats() const {
44 return false;
45 }
46
47 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const {
48 return blink::WebCache::ResourceTypeStats();
49 }
50
51 void Task::Refresh(const base::TimeDelta& update_interval) {
52 // TODO(afakhry): Add code here to skip this when network usage refresh has
53 // never been requested.
54
55 network_usage_ =
56 (current_byte_count_ * base::TimeDelta::FromSeconds(1)) / update_interval;
57
58 // Reset the current byte count for this task.
59 current_byte_count_ = 0;
60 }
61
62 void Task::OnBytesRead(int64 bytes_read) {
63 current_byte_count_ += bytes_read;
64 }
65
66 // static
67 int64 Task::last_id_ = 0;
68
69 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698