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

Unified Diff: base/deferred_sequenced_task_runner.h

Issue 2726523002: Pass Callback to TaskRunner by value and consume it on invocation (1) (Closed)
Patch Set: s/base::ResetAndReturn/std::move/ Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: base/deferred_sequenced_task_runner.h
diff --git a/base/deferred_sequenced_task_runner.h b/base/deferred_sequenced_task_runner.h
index e5d57df5a0ba4ed095c4b6a71b66f56caf9fb14c..94651ddd6c659c89b4ee1e250f47cc4be51c5778 100644
--- a/base/deferred_sequenced_task_runner.h
+++ b/base/deferred_sequenced_task_runner.h
@@ -28,13 +28,13 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
// TaskRunner implementation
bool PostDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay) override;
bool RunsTasksOnCurrentThread() const override;
// SequencedTaskRunner implementation
bool PostNonNestableDelayedTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay) override;
// Start the execution - posts all queued tasks to the target executor. The
@@ -46,8 +46,9 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
private:
struct DeferredTask {
DeferredTask();
- DeferredTask(const DeferredTask& other);
+ DeferredTask(DeferredTask&& other);
~DeferredTask();
+ DeferredTask& operator=(DeferredTask&& other);
tracked_objects::Location posted_from;
Closure task;
@@ -60,7 +61,7 @@ class BASE_EXPORT DeferredSequencedTaskRunner : public SequencedTaskRunner {
// Creates a |Task| object and adds it to |deferred_tasks_queue_|.
void QueueDeferredTask(const tracked_objects::Location& from_here,
- const Closure& task,
+ Closure task,
TimeDelta delay,
bool is_non_nestable);

Powered by Google App Engine
This is Rietveld 408576698