OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_manager/task_manager.h" | 5 #include "chrome/browser/task_manager/task_manager.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 TaskManagerModel::TaskManagerModel(TaskManager* task_manager) | 72 TaskManagerModel::TaskManagerModel(TaskManager* task_manager) |
73 : update_requests_(0), | 73 : update_requests_(0), |
74 update_state_(IDLE), | 74 update_state_(IDLE), |
75 goat_salt_(rand()) { | 75 goat_salt_(rand()) { |
76 | 76 |
77 TaskManagerBrowserProcessResourceProvider* browser_provider = | 77 TaskManagerBrowserProcessResourceProvider* browser_provider = |
78 new TaskManagerBrowserProcessResourceProvider(task_manager); | 78 new TaskManagerBrowserProcessResourceProvider(task_manager); |
79 browser_provider->AddRef(); | 79 browser_provider->AddRef(); |
80 providers_.push_back(browser_provider); | 80 providers_.push_back(browser_provider); |
| 81 TaskManagerBackgroundContentsResourceProvider* bc_provider = |
| 82 new TaskManagerBackgroundContentsResourceProvider(task_manager); |
| 83 bc_provider->AddRef(); |
| 84 providers_.push_back(bc_provider); |
81 TaskManagerTabContentsResourceProvider* wc_provider = | 85 TaskManagerTabContentsResourceProvider* wc_provider = |
82 new TaskManagerTabContentsResourceProvider(task_manager); | 86 new TaskManagerTabContentsResourceProvider(task_manager); |
83 wc_provider->AddRef(); | 87 wc_provider->AddRef(); |
84 providers_.push_back(wc_provider); | 88 providers_.push_back(wc_provider); |
85 TaskManagerBackgroundContentsResourceProvider* bc_provider = | |
86 new TaskManagerBackgroundContentsResourceProvider(task_manager); | |
87 bc_provider->AddRef(); | |
88 providers_.push_back(bc_provider); | |
89 TaskManagerChildProcessResourceProvider* child_process_provider = | 89 TaskManagerChildProcessResourceProvider* child_process_provider = |
90 new TaskManagerChildProcessResourceProvider(task_manager); | 90 new TaskManagerChildProcessResourceProvider(task_manager); |
91 child_process_provider->AddRef(); | 91 child_process_provider->AddRef(); |
92 providers_.push_back(child_process_provider); | 92 providers_.push_back(child_process_provider); |
93 TaskManagerExtensionProcessResourceProvider* extension_process_provider = | 93 TaskManagerExtensionProcessResourceProvider* extension_process_provider = |
94 new TaskManagerExtensionProcessResourceProvider(task_manager); | 94 new TaskManagerExtensionProcessResourceProvider(task_manager); |
95 extension_process_provider->AddRef(); | 95 extension_process_provider->AddRef(); |
96 providers_.push_back(extension_process_provider); | 96 providers_.push_back(extension_process_provider); |
97 TaskManagerNotificationResourceProvider* notification_provider = | 97 TaskManagerNotificationResourceProvider* notification_provider = |
98 new TaskManagerNotificationResourceProvider(task_manager); | 98 new TaskManagerNotificationResourceProvider(task_manager); |
(...skipping 14 matching lines...) Expand all Loading... |
113 | 113 |
114 void TaskManagerModel::AddObserver(TaskManagerModelObserver* observer) { | 114 void TaskManagerModel::AddObserver(TaskManagerModelObserver* observer) { |
115 observer_list_.AddObserver(observer); | 115 observer_list_.AddObserver(observer); |
116 } | 116 } |
117 | 117 |
118 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) { | 118 void TaskManagerModel::RemoveObserver(TaskManagerModelObserver* observer) { |
119 observer_list_.RemoveObserver(observer); | 119 observer_list_.RemoveObserver(observer); |
120 } | 120 } |
121 | 121 |
122 string16 TaskManagerModel::GetResourceTitle(int index) const { | 122 string16 TaskManagerModel::GetResourceTitle(int index) const { |
123 CHECK(index < ResourceCount()); | 123 CHECK_LT(index, ResourceCount()); |
124 return WideToUTF16Hack(resources_[index]->GetTitle()); | 124 return WideToUTF16Hack(resources_[index]->GetTitle()); |
125 } | 125 } |
126 | 126 |
127 int64 TaskManagerModel::GetNetworkUsage(int index) const { | 127 int64 TaskManagerModel::GetNetworkUsage(int index) const { |
128 CHECK(index < ResourceCount()); | 128 CHECK_LT(index, ResourceCount()); |
129 return GetNetworkUsage(resources_[index]); | 129 return GetNetworkUsage(resources_[index]); |
130 } | 130 } |
131 | 131 |
132 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { | 132 string16 TaskManagerModel::GetResourceNetworkUsage(int index) const { |
133 int64 net_usage = GetNetworkUsage(index); | 133 int64 net_usage = GetNetworkUsage(index); |
134 if (net_usage == -1) | 134 if (net_usage == -1) |
135 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 135 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
136 if (net_usage == 0) | 136 if (net_usage == 0) |
137 return ASCIIToUTF16("0"); | 137 return ASCIIToUTF16("0"); |
138 string16 net_byte = FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), | 138 string16 net_byte = FormatSpeed(net_usage, GetByteDisplayUnits(net_usage), |
139 true); | 139 true); |
140 // Force number string to have LTR directionality. | 140 // Force number string to have LTR directionality. |
141 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); | 141 return base::i18n::GetDisplayStringInLTRDirectionality(net_byte); |
142 } | 142 } |
143 | 143 |
144 double TaskManagerModel::GetCPUUsage(int index) const { | 144 double TaskManagerModel::GetCPUUsage(int index) const { |
145 CHECK(index < ResourceCount()); | 145 CHECK_LT(index, ResourceCount()); |
146 return GetCPUUsage(resources_[index]); | 146 return GetCPUUsage(resources_[index]); |
147 } | 147 } |
148 | 148 |
149 string16 TaskManagerModel::GetResourceCPUUsage(int index) const { | 149 string16 TaskManagerModel::GetResourceCPUUsage(int index) const { |
150 CHECK(index < ResourceCount()); | 150 CHECK_LT(index, ResourceCount()); |
151 return WideToUTF16Hack(StringPrintf( | 151 return WideToUTF16Hack(StringPrintf( |
152 #if defined(OS_MACOSX) | 152 #if defined(OS_MACOSX) |
153 // Activity Monitor shows %cpu with one decimal digit -- be | 153 // Activity Monitor shows %cpu with one decimal digit -- be |
154 // consistent with that. | 154 // consistent with that. |
155 L"%.1f", | 155 L"%.1f", |
156 #else | 156 #else |
157 L"%.0f", | 157 L"%.0f", |
158 #endif | 158 #endif |
159 GetCPUUsage(resources_[index]))); | 159 GetCPUUsage(resources_[index]))); |
160 } | 160 } |
(...skipping 12 matching lines...) Expand all Loading... |
173 return GetMemCellText(shared_mem); | 173 return GetMemCellText(shared_mem); |
174 } | 174 } |
175 | 175 |
176 string16 TaskManagerModel::GetResourcePhysicalMemory(int index) const { | 176 string16 TaskManagerModel::GetResourcePhysicalMemory(int index) const { |
177 size_t phys_mem; | 177 size_t phys_mem; |
178 GetPhysicalMemory(index, &phys_mem); | 178 GetPhysicalMemory(index, &phys_mem); |
179 return GetMemCellText(phys_mem); | 179 return GetMemCellText(phys_mem); |
180 } | 180 } |
181 | 181 |
182 int TaskManagerModel::GetProcessId(int index) const { | 182 int TaskManagerModel::GetProcessId(int index) const { |
183 CHECK(index < ResourceCount()); | 183 CHECK_LT(index, ResourceCount()); |
184 return base::GetProcId(resources_[index]->GetProcess()); | 184 return base::GetProcId(resources_[index]->GetProcess()); |
185 } | 185 } |
186 | 186 |
187 string16 TaskManagerModel::GetResourceProcessId(int index) const { | 187 string16 TaskManagerModel::GetResourceProcessId(int index) const { |
188 return base::IntToString16(GetProcessId(index)); | 188 return base::IntToString16(GetProcessId(index)); |
189 } | 189 } |
190 | 190 |
191 string16 TaskManagerModel::GetResourceGoatsTeleported(int index) const { | 191 string16 TaskManagerModel::GetResourceGoatsTeleported(int index) const { |
192 CHECK(index < ResourceCount()); | 192 CHECK_LT(index, ResourceCount()); |
193 return base::FormatNumber(GetGoatsTeleported(index)); | 193 return base::FormatNumber(GetGoatsTeleported(index)); |
194 } | 194 } |
195 | 195 |
196 string16 TaskManagerModel::GetResourceWebCoreImageCacheSize( | 196 string16 TaskManagerModel::GetResourceWebCoreImageCacheSize( |
197 int index) const { | 197 int index) const { |
198 CHECK(index < ResourceCount()); | 198 CHECK_LT(index, ResourceCount()); |
199 if (!resources_[index]->ReportsCacheStats()) | 199 if (!resources_[index]->ReportsCacheStats()) |
200 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 200 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
201 const WebKit::WebCache::ResourceTypeStats stats( | 201 const WebKit::WebCache::ResourceTypeStats stats( |
202 resources_[index]->GetWebCoreCacheStats()); | 202 resources_[index]->GetWebCoreCacheStats()); |
203 return FormatStatsSize(stats.images); | 203 return FormatStatsSize(stats.images); |
204 } | 204 } |
205 | 205 |
206 string16 TaskManagerModel::GetResourceWebCoreScriptsCacheSize( | 206 string16 TaskManagerModel::GetResourceWebCoreScriptsCacheSize( |
207 int index) const { | 207 int index) const { |
208 CHECK(index < ResourceCount()); | 208 CHECK_LT(index, ResourceCount()); |
209 if (!resources_[index]->ReportsCacheStats()) | 209 if (!resources_[index]->ReportsCacheStats()) |
210 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 210 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
211 const WebKit::WebCache::ResourceTypeStats stats( | 211 const WebKit::WebCache::ResourceTypeStats stats( |
212 resources_[index]->GetWebCoreCacheStats()); | 212 resources_[index]->GetWebCoreCacheStats()); |
213 return FormatStatsSize(stats.scripts); | 213 return FormatStatsSize(stats.scripts); |
214 } | 214 } |
215 | 215 |
216 string16 TaskManagerModel::GetResourceWebCoreCSSCacheSize( | 216 string16 TaskManagerModel::GetResourceWebCoreCSSCacheSize( |
217 int index) const { | 217 int index) const { |
218 CHECK(index < ResourceCount()); | 218 CHECK_LT(index, ResourceCount()); |
219 if (!resources_[index]->ReportsCacheStats()) | 219 if (!resources_[index]->ReportsCacheStats()) |
220 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 220 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
221 const WebKit::WebCache::ResourceTypeStats stats( | 221 const WebKit::WebCache::ResourceTypeStats stats( |
222 resources_[index]->GetWebCoreCacheStats()); | 222 resources_[index]->GetWebCoreCacheStats()); |
223 return FormatStatsSize(stats.cssStyleSheets); | 223 return FormatStatsSize(stats.cssStyleSheets); |
224 } | 224 } |
225 | 225 |
226 string16 TaskManagerModel::GetResourceSqliteMemoryUsed(int index) const { | 226 string16 TaskManagerModel::GetResourceSqliteMemoryUsed(int index) const { |
227 CHECK(index < ResourceCount()); | 227 CHECK_LT(index, ResourceCount()); |
228 if (!resources_[index]->ReportsSqliteMemoryUsed()) | 228 if (!resources_[index]->ReportsSqliteMemoryUsed()) |
229 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 229 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
230 return GetMemCellText(resources_[index]->SqliteMemoryUsedBytes()); | 230 return GetMemCellText(resources_[index]->SqliteMemoryUsedBytes()); |
231 } | 231 } |
232 | 232 |
233 string16 TaskManagerModel::GetResourceV8MemoryAllocatedSize( | 233 string16 TaskManagerModel::GetResourceV8MemoryAllocatedSize( |
234 int index) const { | 234 int index) const { |
235 if (!resources_[index]->ReportsV8MemoryStats()) | 235 if (!resources_[index]->ReportsV8MemoryStats()) |
236 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); | 236 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT); |
237 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, | 237 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_CACHE_SIZE_CELL_TEXT, |
238 FormatBytes(resources_[index]->GetV8MemoryAllocated(), | 238 FormatBytes(resources_[index]->GetV8MemoryAllocated(), |
239 DATA_UNITS_KIBIBYTE, | 239 DATA_UNITS_KIBIBYTE, |
240 false), | 240 false), |
241 FormatBytes(resources_[index]->GetV8MemoryUsed(), | 241 FormatBytes(resources_[index]->GetV8MemoryUsed(), |
242 DATA_UNITS_KIBIBYTE, | 242 DATA_UNITS_KIBIBYTE, |
243 false)); | 243 false)); |
244 } | 244 } |
245 | 245 |
246 bool TaskManagerModel::IsResourceFirstInGroup(int index) const { | 246 bool TaskManagerModel::IsResourceFirstInGroup(int index) const { |
247 CHECK(index < ResourceCount()); | 247 CHECK_LT(index, ResourceCount()); |
248 TaskManager::Resource* resource = resources_[index]; | 248 TaskManager::Resource* resource = resources_[index]; |
249 GroupMap::const_iterator iter = group_map_.find(resource->GetProcess()); | 249 GroupMap::const_iterator iter = group_map_.find(resource->GetProcess()); |
250 DCHECK(iter != group_map_.end()); | 250 DCHECK(iter != group_map_.end()); |
251 const ResourceList* group = iter->second; | 251 const ResourceList* group = iter->second; |
252 return ((*group)[0] == resource); | 252 return ((*group)[0] == resource); |
253 } | 253 } |
254 | 254 |
| 255 bool TaskManagerModel::IsBackgroundResource(int index) const { |
| 256 CHECK_LT(index, ResourceCount()); |
| 257 return resources_[index]->IsBackground(); |
| 258 } |
| 259 |
255 SkBitmap TaskManagerModel::GetResourceIcon(int index) const { | 260 SkBitmap TaskManagerModel::GetResourceIcon(int index) const { |
256 CHECK(index < ResourceCount()); | 261 CHECK_LT(index, ResourceCount()); |
257 SkBitmap icon = resources_[index]->GetIcon(); | 262 SkBitmap icon = resources_[index]->GetIcon(); |
258 if (!icon.isNull()) | 263 if (!icon.isNull()) |
259 return icon; | 264 return icon; |
260 | 265 |
261 static SkBitmap* default_icon = ResourceBundle::GetSharedInstance(). | 266 static SkBitmap* default_icon = ResourceBundle::GetSharedInstance(). |
262 GetBitmapNamed(IDR_DEFAULT_FAVICON); | 267 GetBitmapNamed(IDR_DEFAULT_FAVICON); |
263 return *default_icon; | 268 return *default_icon; |
264 } | 269 } |
265 | 270 |
266 std::pair<int, int> TaskManagerModel::GetGroupRangeForResource(int index) | 271 std::pair<int, int> TaskManagerModel::GetGroupRangeForResource(int index) |
267 const { | 272 const { |
268 CHECK(index < ResourceCount()); | 273 CHECK_LT(index, ResourceCount()); |
269 TaskManager::Resource* resource = resources_[index]; | 274 TaskManager::Resource* resource = resources_[index]; |
270 GroupMap::const_iterator group_iter = | 275 GroupMap::const_iterator group_iter = |
271 group_map_.find(resource->GetProcess()); | 276 group_map_.find(resource->GetProcess()); |
272 DCHECK(group_iter != group_map_.end()); | 277 DCHECK(group_iter != group_map_.end()); |
273 ResourceList* group = group_iter->second; | 278 ResourceList* group = group_iter->second; |
274 DCHECK(group); | 279 DCHECK(group); |
275 if (group->size() == 1) { | 280 if (group->size() == 1) { |
276 return std::make_pair(index, 1); | 281 return std::make_pair(index, 1); |
277 } else { | 282 } else { |
278 for (int i = index; i >= 0; --i) { | 283 for (int i = index; i >= 0; --i) { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 390 } |
386 | 391 |
387 default: | 392 default: |
388 NOTREACHED(); | 393 NOTREACHED(); |
389 return 0; | 394 return 0; |
390 } | 395 } |
391 } | 396 } |
392 | 397 |
393 base::ProcessHandle TaskManagerModel::GetResourceProcessHandle(int index) | 398 base::ProcessHandle TaskManagerModel::GetResourceProcessHandle(int index) |
394 const { | 399 const { |
395 CHECK(index < ResourceCount()); | 400 CHECK_LT(index, ResourceCount()); |
396 return resources_[index]->GetProcess(); | 401 return resources_[index]->GetProcess(); |
397 } | 402 } |
398 | 403 |
399 TaskManager::Resource::Type TaskManagerModel::GetResourceType(int index) const { | 404 TaskManager::Resource::Type TaskManagerModel::GetResourceType(int index) const { |
400 CHECK(index < ResourceCount()); | 405 CHECK_LT(index, ResourceCount()); |
401 return resources_[index]->GetType(); | 406 return resources_[index]->GetType(); |
402 } | 407 } |
403 | 408 |
404 TabContents* TaskManagerModel::GetResourceTabContents(int index) const { | 409 TabContents* TaskManagerModel::GetResourceTabContents(int index) const { |
405 CHECK(index < ResourceCount()); | 410 CHECK_LT(index, ResourceCount()); |
406 return resources_[index]->GetTabContents(); | 411 return resources_[index]->GetTabContents(); |
407 } | 412 } |
408 | 413 |
409 const Extension* TaskManagerModel::GetResourceExtension(int index) const { | 414 const Extension* TaskManagerModel::GetResourceExtension(int index) const { |
410 CHECK(index < ResourceCount()); | 415 CHECK_LT(index, ResourceCount()); |
411 return resources_[index]->GetExtension(); | 416 return resources_[index]->GetExtension(); |
412 } | 417 } |
413 | 418 |
414 int64 TaskManagerModel::GetNetworkUsage(TaskManager::Resource* resource) | 419 int64 TaskManagerModel::GetNetworkUsage(TaskManager::Resource* resource) |
415 const { | 420 const { |
416 int64 net_usage = GetNetworkUsageForResource(resource); | 421 int64 net_usage = GetNetworkUsageForResource(resource); |
417 if (net_usage == 0 && !resource->SupportNetworkUsage()) | 422 if (net_usage == 0 && !resource->SupportNetworkUsage()) |
418 return -1; | 423 return -1; |
419 return net_usage; | 424 return net_usage; |
420 } | 425 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } else { | 609 } else { |
605 group_entries = group_iter->second; | 610 group_entries = group_iter->second; |
606 group_entries->push_back(resource); | 611 group_entries->push_back(resource); |
607 | 612 |
608 // Insert the new entry right after the last entry of its group. | 613 // Insert the new entry right after the last entry of its group. |
609 ResourceList::iterator iter = | 614 ResourceList::iterator iter = |
610 std::find(resources_.begin(), | 615 std::find(resources_.begin(), |
611 resources_.end(), | 616 resources_.end(), |
612 (*group_entries)[group_entries->size() - 2]); | 617 (*group_entries)[group_entries->size() - 2]); |
613 DCHECK(iter != resources_.end()); | 618 DCHECK(iter != resources_.end()); |
614 new_entry_index = static_cast<int>(iter - resources_.begin()); | 619 new_entry_index = static_cast<int>(iter - resources_.begin()) + 1; |
615 resources_.insert(++iter, resource); | 620 resources_.insert(++iter, resource); |
616 } | 621 } |
617 | 622 |
618 // Create the ProcessMetrics for this process if needed (not in map). | 623 // Create the ProcessMetrics for this process if needed (not in map). |
619 if (metrics_map_.find(process) == metrics_map_.end()) { | 624 if (metrics_map_.find(process) == metrics_map_.end()) { |
620 base::ProcessMetrics* pm = | 625 base::ProcessMetrics* pm = |
621 #if !defined(OS_MACOSX) | 626 #if !defined(OS_MACOSX) |
622 base::ProcessMetrics::CreateProcessMetrics(process); | 627 base::ProcessMetrics::CreateProcessMetrics(process); |
623 #else | 628 #else |
624 base::ProcessMetrics::CreateProcessMetrics(process, | 629 base::ProcessMetrics::CreateProcessMetrics(process, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 | 713 |
709 // Clear the network maps. | 714 // Clear the network maps. |
710 current_byte_count_map_.clear(); | 715 current_byte_count_map_.clear(); |
711 displayed_network_usage_map_.clear(); | 716 displayed_network_usage_map_.clear(); |
712 | 717 |
713 FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, | 718 FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, |
714 OnItemsRemoved(0, size)); | 719 OnItemsRemoved(0, size)); |
715 } | 720 } |
716 } | 721 } |
717 | 722 |
| 723 void TaskManagerModel::ModelChanged() { |
| 724 // Notify the table that the contents have changed for it to redraw. |
| 725 FOR_EACH_OBSERVER(TaskManagerModelObserver, observer_list_, OnModelChanged()); |
| 726 } |
| 727 |
718 void TaskManagerModel::NotifyResourceTypeStats( | 728 void TaskManagerModel::NotifyResourceTypeStats( |
719 base::ProcessId renderer_id, | 729 base::ProcessId renderer_id, |
720 const WebKit::WebCache::ResourceTypeStats& stats) { | 730 const WebKit::WebCache::ResourceTypeStats& stats) { |
721 for (ResourceList::iterator it = resources_.begin(); | 731 for (ResourceList::iterator it = resources_.begin(); |
722 it != resources_.end(); ++it) { | 732 it != resources_.end(); ++it) { |
723 if (base::GetProcId((*it)->GetProcess()) == renderer_id) { | 733 if (base::GetProcId((*it)->GetProcess()) == renderer_id) { |
724 (*it)->NotifyResourceTypeStats(stats); | 734 (*it)->NotifyResourceTypeStats(stats); |
725 } | 735 } |
726 } | 736 } |
727 } | 737 } |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 } | 969 } |
960 | 970 |
961 void TaskManager::RemoveResource(Resource* resource) { | 971 void TaskManager::RemoveResource(Resource* resource) { |
962 model_->RemoveResource(resource); | 972 model_->RemoveResource(resource); |
963 } | 973 } |
964 | 974 |
965 void TaskManager::OnWindowClosed() { | 975 void TaskManager::OnWindowClosed() { |
966 model_->StopUpdating(); | 976 model_->StopUpdating(); |
967 } | 977 } |
968 | 978 |
| 979 void TaskManager::ModelChanged() { |
| 980 model_->ModelChanged(); |
| 981 } |
| 982 |
969 // static | 983 // static |
970 TaskManager* TaskManager::GetInstance() { | 984 TaskManager* TaskManager::GetInstance() { |
971 return Singleton<TaskManager>::get(); | 985 return Singleton<TaskManager>::get(); |
972 } | 986 } |
973 | 987 |
974 void TaskManager::OpenAboutMemory() { | 988 void TaskManager::OpenAboutMemory() { |
975 Browser* browser = BrowserList::GetLastActive(); | 989 Browser* browser = BrowserList::GetLastActive(); |
976 | 990 |
977 if (!browser) { | 991 if (!browser) { |
978 // On OS X, the task manager can be open without any open browser windows. | 992 // On OS X, the task manager can be open without any open browser windows. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 MetricsMap::const_iterator iter = metrics_map_.find(handle); | 1024 MetricsMap::const_iterator iter = metrics_map_.find(handle); |
1011 if (iter == metrics_map_.end()) | 1025 if (iter == metrics_map_.end()) |
1012 return false; | 1026 return false; |
1013 | 1027 |
1014 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) | 1028 if (!iter->second->GetMemoryBytes(&usage->first, &usage->second)) |
1015 return false; | 1029 return false; |
1016 | 1030 |
1017 memory_usage_map_.insert(std::make_pair(handle, *usage)); | 1031 memory_usage_map_.insert(std::make_pair(handle, *usage)); |
1018 return true; | 1032 return true; |
1019 } | 1033 } |
OLD | NEW |