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

Side by Side Diff: base/sequenced_task_runner.cc

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 unified diff | Download patch
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 "base/sequenced_task_runner.h" 5 #include "base/sequenced_task_runner.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 10
9 namespace base { 11 namespace base {
10 12
11 bool SequencedTaskRunner::PostNonNestableTask( 13 bool SequencedTaskRunner::PostNonNestableTask(
12 const tracked_objects::Location& from_here, 14 const tracked_objects::Location& from_here,
13 const Closure& task) { 15 Closure task) {
14 return PostNonNestableDelayedTask(from_here, task, base::TimeDelta()); 16 return PostNonNestableDelayedTask(from_here, std::move(task),
17 base::TimeDelta());
15 } 18 }
16 19
17 bool SequencedTaskRunner::DeleteOrReleaseSoonInternal( 20 bool SequencedTaskRunner::DeleteOrReleaseSoonInternal(
18 const tracked_objects::Location& from_here, 21 const tracked_objects::Location& from_here,
19 void (*deleter)(const void*), 22 void (*deleter)(const void*),
20 const void* object) { 23 const void* object) {
21 return PostNonNestableTask(from_here, Bind(deleter, object)); 24 return PostNonNestableTask(from_here, Bind(deleter, object));
22 } 25 }
23 26
24 OnTaskRunnerDeleter::OnTaskRunnerDeleter( 27 OnTaskRunnerDeleter::OnTaskRunnerDeleter(
25 scoped_refptr<SequencedTaskRunner> task_runner) 28 scoped_refptr<SequencedTaskRunner> task_runner)
26 : task_runner_(std::move(task_runner)) { 29 : task_runner_(std::move(task_runner)) {
27 } 30 }
28 31
29 OnTaskRunnerDeleter::~OnTaskRunnerDeleter() { 32 OnTaskRunnerDeleter::~OnTaskRunnerDeleter() {
30 } 33 }
31 34
32 OnTaskRunnerDeleter::OnTaskRunnerDeleter(OnTaskRunnerDeleter&&) = default; 35 OnTaskRunnerDeleter::OnTaskRunnerDeleter(OnTaskRunnerDeleter&&) = default;
33 36
34 OnTaskRunnerDeleter& OnTaskRunnerDeleter::operator=( 37 OnTaskRunnerDeleter& OnTaskRunnerDeleter::operator=(
35 OnTaskRunnerDeleter&&) = default; 38 OnTaskRunnerDeleter&&) = default;
36 39
37 } // namespace base 40 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698