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

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

Issue 2028753002: Make Task Manager sort more meaningful (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use a default argument instead of a second ctor. Created 4 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/task_management/providers/task.h" 5 #include "chrome/browser/task_management/providers/task.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_attributes_entry.h" 12 #include "chrome/browser/profiles/profile_attributes_entry.h"
13 #include "chrome/browser/profiles/profile_attributes_storage.h" 13 #include "chrome/browser/profiles/profile_attributes_storage.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/task_management/task_manager_observer.h" 15 #include "chrome/browser/task_management/task_manager_observer.h"
16 #include "content/public/common/result_codes.h" 16 #include "content/public/common/result_codes.h"
17 17
18 namespace task_management { 18 namespace task_management {
19 19
20 namespace { 20 namespace {
21 21
22 // The last ID given to the previously created task. 22 // The last ID given to the previously created task.
23 int64_t g_last_id = 0; 23 int64_t g_last_id = 0;
24 24
25 } // namespace 25 } // namespace
26 26
27
28 Task::Task(const base::string16& title, 27 Task::Task(const base::string16& title,
29 const std::string& rappor_sample, 28 const std::string& rappor_sample,
30 const gfx::ImageSkia* icon, 29 const gfx::ImageSkia* icon,
31 base::ProcessHandle handle) 30 base::ProcessHandle handle,
31 base::ProcessId process_id)
32 : task_id_(g_last_id++), 32 : task_id_(g_last_id++),
33 network_usage_(-1), 33 network_usage_(-1),
34 current_byte_count_(-1), 34 current_byte_count_(-1),
35 title_(title), 35 title_(title),
36 rappor_sample_name_(rappor_sample), 36 rappor_sample_name_(rappor_sample),
37 icon_(icon ? *icon : gfx::ImageSkia()), 37 icon_(icon ? *icon : gfx::ImageSkia()),
38 process_handle_(handle), 38 process_handle_(handle),
39 process_id_(base::GetProcId(handle)) { 39 process_id_(process_id != base::kNullProcessId
40 } 40 ? process_id
41 : base::GetProcId(handle)) {}
41 42
42 Task::~Task() { 43 Task::~Task() {}
43 }
44 44
45 // static 45 // static
46 base::string16 Task::GetProfileNameFromProfile(Profile* profile) { 46 base::string16 Task::GetProfileNameFromProfile(Profile* profile) {
47 DCHECK(profile); 47 DCHECK(profile);
48 ProfileAttributesEntry* entry; 48 ProfileAttributesEntry* entry;
49 if (g_browser_process->profile_manager()->GetProfileAttributesStorage(). 49 if (g_browser_process->profile_manager()->GetProfileAttributesStorage().
50 GetProfileAttributesWithPath(profile->GetOriginalProfile()->GetPath(), 50 GetProfileAttributesWithPath(profile->GetOriginalProfile()->GetPath(),
51 &entry)) { 51 &entry)) {
52 return entry->GetName(); 52 return entry->GetName();
53 } 53 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 base::string16 Task::GetProfileName() const { 98 base::string16 Task::GetProfileName() const {
99 return base::string16(); 99 return base::string16();
100 } 100 }
101 101
102 int Task::GetTabId() const { 102 int Task::GetTabId() const {
103 return -1; 103 return -1;
104 } 104 }
105 105
106 const Task* Task::GetParentTask() const {
107 return nullptr;
108 }
109
106 bool Task::ReportsSqliteMemory() const { 110 bool Task::ReportsSqliteMemory() const {
107 return GetSqliteMemoryUsed() != -1; 111 return GetSqliteMemoryUsed() != -1;
108 } 112 }
109 113
110 int64_t Task::GetSqliteMemoryUsed() const { 114 int64_t Task::GetSqliteMemoryUsed() const {
111 return -1; 115 return -1;
112 } 116 }
113 117
114 bool Task::ReportsV8Memory() const { 118 bool Task::ReportsV8Memory() const {
115 return GetV8MemoryAllocated() != -1; 119 return GetV8MemoryAllocated() != -1;
(...skipping 13 matching lines...) Expand all
129 133
130 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { 134 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const {
131 return blink::WebCache::ResourceTypeStats(); 135 return blink::WebCache::ResourceTypeStats();
132 } 136 }
133 137
134 bool Task::ReportsNetworkUsage() const { 138 bool Task::ReportsNetworkUsage() const {
135 return network_usage_ != -1; 139 return network_usage_ != -1;
136 } 140 }
137 141
138 } // namespace task_management 142 } // namespace task_management
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698