| Index: chrome/browser/after_startup_task_utils.cc
|
| diff --git a/chrome/browser/after_startup_task_utils.cc b/chrome/browser/after_startup_task_utils.cc
|
| index c5c29e8b8cb599f7305a2df9b0a82abce8dd1e7c..3f5e49033ed3bbdcf9ab1d67abdf804d56ad46e4 100644
|
| --- a/chrome/browser/after_startup_task_utils.cc
|
| +++ b/chrome/browser/after_startup_task_utils.cc
|
| @@ -7,6 +7,7 @@
|
| #include <memory>
|
| #include <utility>
|
|
|
| +#include "base/callback_helpers.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ptr_util.h"
|
| @@ -34,13 +35,13 @@ namespace {
|
| struct AfterStartupTask {
|
| AfterStartupTask(const tracked_objects::Location& from_here,
|
| const scoped_refptr<base::TaskRunner>& task_runner,
|
| - const base::Closure& task)
|
| - : from_here(from_here), task_runner(task_runner), task(task) {}
|
| + base::Closure task)
|
| + : from_here(from_here), task_runner(task_runner), task(std::move(task)) {}
|
| ~AfterStartupTask() {}
|
|
|
| const tracked_objects::Location from_here;
|
| const scoped_refptr<base::TaskRunner> task_runner;
|
| - const base::Closure task;
|
| + base::Closure task;
|
| };
|
|
|
| // The flag may be read on any thread, but must only be set on the UI thread.
|
| @@ -60,7 +61,7 @@ bool IsBrowserStartupComplete() {
|
| void RunTask(std::unique_ptr<AfterStartupTask> queued_task) {
|
| // We're careful to delete the caller's |task| on the target runner's thread.
|
| DCHECK(queued_task->task_runner->RunsTasksOnCurrentThread());
|
| - queued_task->task.Run();
|
| + base::ResetAndReturn(&queued_task->task).Run();
|
| }
|
|
|
| void ScheduleTask(std::unique_ptr<AfterStartupTask> queued_task) {
|
| @@ -202,10 +203,11 @@ AfterStartupTaskUtils::Runner::~Runner() = default;
|
|
|
| bool AfterStartupTaskUtils::Runner::PostDelayedTask(
|
| const tracked_objects::Location& from_here,
|
| - const base::Closure& task,
|
| + base::Closure task,
|
| base::TimeDelta delay) {
|
| DCHECK(delay.is_zero());
|
| - AfterStartupTaskUtils::PostTask(from_here, destination_runner_, task);
|
| + AfterStartupTaskUtils::PostTask(from_here, destination_runner_,
|
| + std::move(task));
|
| return true;
|
| }
|
|
|
| @@ -221,14 +223,14 @@ void AfterStartupTaskUtils::StartMonitoringStartup() {
|
| void AfterStartupTaskUtils::PostTask(
|
| const tracked_objects::Location& from_here,
|
| const scoped_refptr<base::TaskRunner>& destination_runner,
|
| - const base::Closure& task) {
|
| + base::Closure task) {
|
| if (IsBrowserStartupComplete()) {
|
| - destination_runner->PostTask(from_here, task);
|
| + destination_runner->PostTask(from_here, std::move(task));
|
| return;
|
| }
|
|
|
| std::unique_ptr<AfterStartupTask> queued_task(
|
| - new AfterStartupTask(from_here, destination_runner, task));
|
| + new AfterStartupTask(from_here, destination_runner, std::move(task)));
|
| QueueTask(std::move(queued_task));
|
| }
|
|
|
|
|