summaryrefslogtreecommitdiffstats
path: root/chrome/browser/service
diff options
context:
space:
mode:
authorscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-25 22:21:20 +0000
committerscottbyer@google.com <scottbyer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-25 22:21:20 +0000
commit0a87ce4c5868a9c79c34d91fc2aa0175725b0ba1 (patch)
treeab0afb2d5c9cdf157346c83fe5985dd2d2fae067 /chrome/browser/service
parent02a7e0c7b8bcafbfdaf1eba8e4da53014c41604c (diff)
downloadchromium_src-0a87ce4c5868a9c79c34d91fc2aa0175725b0ba1.zip
chromium_src-0a87ce4c5868a9c79c34d91fc2aa0175725b0ba1.tar.gz
chromium_src-0a87ce4c5868a9c79c34d91fc2aa0175725b0ba1.tar.bz2
Memory leak from cloud printing proxy UI.
First, stop calling some service things from the tabbed options UI support code when cloud printing isn't enabled. Second, have better ownership of the leaked task. BUG=60008, 60313 TEST=OptionsUITest.FLAKY_CommandAgainGoesBackToOptionsTab under valgrind. Review URL: http://codereview.chromium.org/4033003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/service')
-rw-r--r--chrome/browser/service/service_process_control.cc23
1 files changed, 14 insertions, 9 deletions
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 6a41395..74efc36 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -39,21 +39,24 @@ class ServiceProcessControl::Launcher
void Run(Task* task) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ notify_task_.reset(task);
BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
- NewRunnableMethod(this, &Launcher::DoRun, task));
+ NewRunnableMethod(this, &Launcher::DoRun));
}
bool launched() const { return launched_; }
private:
- void DoRun(Task* task) {
+ void DoRun() {
+ DCHECK(notify_task_.get());
base::LaunchApp(*cmd_line_.get(), false, true, NULL);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(this, &Launcher::DoDetectLaunched, task));
+ NewRunnableMethod(this, &Launcher::DoDetectLaunched));
}
- void DoDetectLaunched(Task* task) {
+ void DoDetectLaunched() {
+ DCHECK(notify_task_.get());
const uint32 kMaxLaunchDetectRetries = 10;
{
@@ -66,7 +69,7 @@ class ServiceProcessControl::Launcher
if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this, &Launcher::Notify, task));
+ NewRunnableMethod(this, &Launcher::Notify));
return;
}
retry_count_++;
@@ -74,17 +77,19 @@ class ServiceProcessControl::Launcher
const int kDetectLaunchRetry = 2000;
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- NewRunnableMethod(this, &Launcher::DoDetectLaunched, task),
+ NewRunnableMethod(this, &Launcher::DoDetectLaunched),
kDetectLaunchRetry);
}
- void Notify(Task* task) {
- task->Run();
- delete task;
+ void Notify() {
+ DCHECK(notify_task_.get());
+ notify_task_->Run();
+ notify_task_.reset();
}
ServiceProcessControl* process_;
scoped_ptr<CommandLine> cmd_line_;
+ scoped_ptr<Task> notify_task_;
bool launched_;
uint32 retry_count_;
};