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

Side by Side Diff: chrome/browser/task_manager/task_manager.cc

Issue 10861018: Fix memory leaks from adding GPU memory to task manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
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/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/i18n/number_formatting.h" 9 #include "base/i18n/number_formatting.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 OVERRIDE { 973 OVERRIDE {
974 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { 974 if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
975 NotifyVideoMemoryUsageStats(video_memory_usage_stats); 975 NotifyVideoMemoryUsageStats(video_memory_usage_stats);
976 } else { 976 } else {
977 BrowserThread::PostTask( 977 BrowserThread::PostTask(
978 BrowserThread::UI, FROM_HERE, base::Bind( 978 BrowserThread::UI, FROM_HERE, base::Bind(
979 &TaskManagerModelGpuDataManagerObserver:: 979 &TaskManagerModelGpuDataManagerObserver::
980 NotifyVideoMemoryUsageStats, 980 NotifyVideoMemoryUsageStats,
981 video_memory_usage_stats)); 981 video_memory_usage_stats));
982 } 982 }
983 delete this;
984 } 983 }
985 }; 984 };
986 985
987 void TaskManagerModel::RefreshVideoMemoryUsageStats() 986 void TaskManagerModel::RefreshVideoMemoryUsageStats()
988 { 987 {
989 if (pending_video_memory_usage_stats_update_) return; 988 if (pending_video_memory_usage_stats_update_) return;
989 if (!video_memory_usage_stats_observer_.get()) {
990 video_memory_usage_stats_observer_.reset(
991 new TaskManagerModelGpuDataManagerObserver());
992 }
990 pending_video_memory_usage_stats_update_ = true; 993 pending_video_memory_usage_stats_update_ = true;
991 new TaskManagerModelGpuDataManagerObserver;
992 content::GpuDataManager::GetInstance()->RequestVideoMemoryUsageStatsUpdate(); 994 content::GpuDataManager::GetInstance()->RequestVideoMemoryUsageStatsUpdate();
993 } 995 }
994 996
995 void TaskManagerModel::Refresh() { 997 void TaskManagerModel::Refresh() {
996 DCHECK_NE(IDLE, update_state_); 998 DCHECK_NE(IDLE, update_state_);
997 999
998 if (update_state_ == STOPPING) { 1000 if (update_state_ == STOPPING) {
999 // We have been asked to stop. 1001 // We have been asked to stop.
1000 update_state_ = IDLE; 1002 update_state_ = IDLE;
1001 return; 1003 return;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 // Count the number of extensions with background pages (including 1326 // Count the number of extensions with background pages (including
1325 // incognito). 1327 // incognito).
1326 count += CountExtensionBackgroundPagesForProfile(profile); 1328 count += CountExtensionBackgroundPagesForProfile(profile);
1327 if (profile->HasOffTheRecordProfile()) { 1329 if (profile->HasOffTheRecordProfile()) {
1328 count += CountExtensionBackgroundPagesForProfile( 1330 count += CountExtensionBackgroundPagesForProfile(
1329 profile->GetOffTheRecordProfile()); 1331 profile->GetOffTheRecordProfile());
1330 } 1332 }
1331 } 1333 }
1332 return count; 1334 return count;
1333 } 1335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698