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

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: Fix unittest 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 101
102 base::string16 Task::GetProfileName() const { 102 base::string16 Task::GetProfileName() const {
103 return base::string16(); 103 return base::string16();
104 } 104 }
105 105
106 int Task::GetTabId() const { 106 int Task::GetTabId() const {
107 return -1; 107 return -1;
108 } 108 }
109 109
110 bool Task::HasParentTask() const {
111 return GetParentTask() != nullptr;
112 }
113
114 const Task* Task::GetParentTask() const {
115 return nullptr;
116 }
117
110 bool Task::ReportsSqliteMemory() const { 118 bool Task::ReportsSqliteMemory() const {
111 return GetSqliteMemoryUsed() != -1; 119 return GetSqliteMemoryUsed() != -1;
112 } 120 }
113 121
114 int64_t Task::GetSqliteMemoryUsed() const { 122 int64_t Task::GetSqliteMemoryUsed() const {
115 return -1; 123 return -1;
116 } 124 }
117 125
118 bool Task::ReportsV8Memory() const { 126 bool Task::ReportsV8Memory() const {
119 return GetV8MemoryAllocated() != -1; 127 return GetV8MemoryAllocated() != -1;
(...skipping 13 matching lines...) Expand all
133 141
134 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const { 142 blink::WebCache::ResourceTypeStats Task::GetWebCacheStats() const {
135 return blink::WebCache::ResourceTypeStats(); 143 return blink::WebCache::ResourceTypeStats();
136 } 144 }
137 145
138 bool Task::ReportsNetworkUsage() const { 146 bool Task::ReportsNetworkUsage() const {
139 return network_usage_ != -1; 147 return network_usage_ != -1;
140 } 148 }
141 149
142 } // namespace task_management 150 } // namespace task_management
OLDNEW
« no previous file with comments | « chrome/browser/task_management/providers/task.h ('k') | chrome/browser/task_management/providers/web_contents/subframe_task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698