summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 17:11:45 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-27 17:11:45 +0000
commitfc6536ff4a94bccc3df5c821922bdb4603283fd1 (patch)
tree82e1d61bc3b4bd3d4aba74a9ff45cda2ab853851 /chrome/browser/task_manager.cc
parent4601745d4130886fa65e8a5096c16ee99a19e37b (diff)
downloadchromium_src-fc6536ff4a94bccc3df5c821922bdb4603283fd1.zip
chromium_src-fc6536ff4a94bccc3df5c821922bdb4603283fd1.tar.gz
chromium_src-fc6536ff4a94bccc3df5c821922bdb4603283fd1.tar.bz2
Fix a memory leak in TaskManager
http://crbug.com/11068 Review URL: http://codereview.chromium.org/99059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index c11b79c..b932970 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -358,9 +358,13 @@ void TaskManagerTableModel::AddResource(TaskManager::Resource* resource) {
new_entry_index = static_cast<int>(iter - resources_.begin());
resources_.insert(++iter, resource);
}
- base::ProcessMetrics* pm =
- base::ProcessMetrics::CreateProcessMetrics(process);
- metrics_map_[process] = pm;
+
+ // Create the ProcessMetrics for this process if needed (not in map).
+ if (metrics_map_.find(process) == metrics_map_.end()) {
+ base::ProcessMetrics* pm =
+ base::ProcessMetrics::CreateProcessMetrics(process);
+ metrics_map_[process] = pm;
+ }
// Notify the table that the contents have changed for it to redraw.
DCHECK(observer_);