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

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: Removed unconventional comments 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 is_first_in_group_(true) {
19 }
20
21 Task::~Task() {
22 }
23
24 base::string16 Task::GetProfileName() const {
25 return base::string16();
26 }
27
28 int Task::GetRoutingID() const {
29 return 0;
30 }
31
32 size_t Task::GetSqliteMemoryUsed() const {
33 return -1U;
34 }
35
36 size_t Task::GetV8MemoryAllocated() const {
37 return -1U;
38 }
39
40 size_t Task::GetV8MemoryUsed() const {
41 return -1U;
42 }
43
44 bool Task::ReportsWebCacheStats() const {
45 return false;
46 }
47
48 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const {
49 return blink::WebCache::ResourceTypeStats();
50 }
51
52 void Task::Refresh(const base::TimeDelta& update_duration) {
53 // TODO(afakhry): Add code here to skip this when network usage refresh has
54 // never been requested.
55
56 int64 update_time_secs = update_duration.InSeconds();
57 DCHECK(update_time_secs != 0);
58 network_usage_ = current_byte_count_ / update_time_secs;
ncarter (slow) 2015/03/31 22:31:32 I really think using a floating point divide here
afakhry 2015/03/31 23:22:09 I don't think that this floating point operation i
afakhry 2015/03/31 23:44:14 We probably might not even need a TimeDelta object
ncarter (slow) 2015/04/01 16:52:14 What downside do you see to using InSecondsF()? Wh
59
60 // Reset the current byte count for this task.
61 current_byte_count_ = 0;
62 }
63
64 void Task::OnBytesRead(int64 bytes_read) {
65 current_byte_count_ += bytes_read;
66 }
67
68 // static
69 int64 Task::last_id_ = 0;
70
71 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698