Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/i18n/number_formatting.h" | 8 #include "base/i18n/number_formatting.h" |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/process/process_metrics.h" | 12 #include "base/process/process_metrics.h" |
| 13 #include "base/profiler/scoped_tracker.h" | |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/profiles/profile_window.h" | 21 #include "chrome/browser/profiles/profile_window.h" |
| 21 #include "chrome/browser/task_manager/background_information.h" | 22 #include "chrome/browser/task_manager/background_information.h" |
| 22 #include "chrome/browser/task_manager/browser_process_resource_provider.h" | 23 #include "chrome/browser/task_manager/browser_process_resource_provider.h" |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 for (ResourceList::iterator it = resources_.begin(); | 1223 for (ResourceList::iterator it = resources_.begin(); |
| 1223 it != resources_.end(); ++it) { | 1224 it != resources_.end(); ++it) { |
| 1224 if (base::GetProcId((*it)->GetProcess()) == renderer_id) { | 1225 if (base::GetProcId((*it)->GetProcess()) == renderer_id) { |
| 1225 (*it)->NotifyV8HeapStats(v8_memory_allocated, v8_memory_used); | 1226 (*it)->NotifyV8HeapStats(v8_memory_allocated, v8_memory_used); |
| 1226 } | 1227 } |
| 1227 } | 1228 } |
| 1228 } | 1229 } |
| 1229 | 1230 |
| 1230 void TaskManagerModel::NotifyBytesRead(const net::URLRequest& request, | 1231 void TaskManagerModel::NotifyBytesRead(const net::URLRequest& request, |
| 1231 int byte_count) { | 1232 int byte_count) { |
| 1233 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed. | |
| 1234 tracked_objects::ScopedTracker tracking_profile( | |
| 1235 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
| 1236 "423948 TaskManagerModel::NotifyBytesRead")); | |
|
mmenke
2014/11/17 15:38:16
I suggest adding another one just above the bytes_
vadimt
2014/11/18 01:14:27
Done.
| |
| 1237 | |
| 1232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1233 if (!is_updating_byte_count_) | 1239 if (!is_updating_byte_count_) |
| 1234 return; | 1240 return; |
| 1235 | 1241 |
| 1236 // Only net::URLRequestJob instances created by the ResourceDispatcherHost | 1242 // Only net::URLRequestJob instances created by the ResourceDispatcherHost |
| 1237 // have an associated ResourceRequestInfo and a render frame associated. | 1243 // have an associated ResourceRequestInfo and a render frame associated. |
| 1238 // All other jobs will have -1 returned for the render process child and | 1244 // All other jobs will have -1 returned for the render process child and |
| 1239 // routing ids - the jobs may still match a resource based on their origin id, | 1245 // routing ids - the jobs may still match a resource based on their origin id, |
| 1240 // otherwise BytesRead() will attribute the activity to the Browser resource. | 1246 // otherwise BytesRead() will attribute the activity to the Browser resource. |
| 1241 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); | 1247 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(&request); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1544 params.host_desktop_type = desktop_type; | 1550 params.host_desktop_type = desktop_type; |
| 1545 chrome::Navigate(¶ms); | 1551 chrome::Navigate(¶ms); |
| 1546 } | 1552 } |
| 1547 | 1553 |
| 1548 TaskManager::TaskManager() | 1554 TaskManager::TaskManager() |
| 1549 : model_(new TaskManagerModel(this)) { | 1555 : model_(new TaskManagerModel(this)) { |
| 1550 } | 1556 } |
| 1551 | 1557 |
| 1552 TaskManager::~TaskManager() { | 1558 TaskManager::~TaskManager() { |
| 1553 } | 1559 } |
| OLD | NEW |