Chromium Code Reviews| Index: content/browser/startup_task_runner.cc |
| diff --git a/content/browser/startup_task_runner.cc b/content/browser/startup_task_runner.cc |
| index d1fc904d5266b1f7dcc48a913a1827578b158c8a..6fa630bde30f604d1b7f1d809a2a5e5148a74817 100644 |
| --- a/content/browser/startup_task_runner.cc |
| +++ b/content/browser/startup_task_runner.cc |
| @@ -27,6 +27,8 @@ void StartupTaskRunner::StartRunningTasksAsync() { |
| if (task_list_.empty()) { |
| if (!startup_complete_callback_.is_null()) { |
| startup_complete_callback_.Run(result); |
| + // Clear the callback to prevent it being called a second time |
| + startup_complete_callback_ = base::Callback<void(int)>(); |
|
jam
2013/10/07 16:17:03
nit: startup_complete_callback_.Reset();
aberent
2013/10/10 13:56:36
Done.
|
| } |
| } else { |
| const base::Closure next_task = |
| @@ -43,8 +45,11 @@ void StartupTaskRunner::RunAllTasksNow() { |
| result = it->Run(); |
| if (result > 0) break; |
| } |
| + task_list_.clear(); |
| if (!startup_complete_callback_.is_null()) { |
| startup_complete_callback_.Run(result); |
| + // Clear the callback to prevent it being called a second time |
| + startup_complete_callback_ = base::Callback<void(int)>(); |
|
jam
2013/10/07 16:17:03
ditto
aberent
2013/10/10 13:56:36
Done.
|
| } |
| } |
| @@ -57,9 +62,15 @@ void StartupTaskRunner::WrappedTask() { |
| } |
| int result = task_list_.front().Run(); |
| task_list_.pop_front(); |
| - if (result > 0 || task_list_.empty()) { |
| + if (result > 0) { |
| + // Stop now and throw away the remaining tasks |
| + task_list_.clear(); |
| + } |
| + if (task_list_.empty()) { |
| if (!startup_complete_callback_.is_null()) { |
| startup_complete_callback_.Run(result); |
| + // Clear the callback to prevent it being called a second time |
| + startup_complete_callback_ = base::Callback<void(int)>(); |
|
jam
2013/10/07 16:17:03
ditto
aberent
2013/10/10 13:56:36
Done.
|
| } |
| } else { |
| const base::Closure next_task = |