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

Side by Side Diff: base/task_runner.cc

Issue 2678303002: Pass Callback by value on PostTaskAndReply family (Closed)
Patch Set: #include Created 3 years, 10 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/task_runner.h" 5 #include "base/task_runner.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/threading/post_task_and_reply_impl.h" 9 #include "base/threading/post_task_and_reply_impl.h"
10 10
(...skipping 27 matching lines...) Expand all
38 return destination_->PostTask(from_here, task); 38 return destination_->PostTask(from_here, task);
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 bool TaskRunner::PostTask(const tracked_objects::Location& from_here, 43 bool TaskRunner::PostTask(const tracked_objects::Location& from_here,
44 const Closure& task) { 44 const Closure& task) {
45 return PostDelayedTask(from_here, task, base::TimeDelta()); 45 return PostDelayedTask(from_here, task, base::TimeDelta());
46 } 46 }
47 47
48 bool TaskRunner::PostTaskAndReply( 48 bool TaskRunner::PostTaskAndReply(const tracked_objects::Location& from_here,
49 const tracked_objects::Location& from_here, 49 Closure task,
50 const Closure& task, 50 Closure reply) {
51 const Closure& reply) {
52 return PostTaskAndReplyTaskRunner(this).PostTaskAndReply( 51 return PostTaskAndReplyTaskRunner(this).PostTaskAndReply(
53 from_here, task, reply); 52 from_here, std::move(task), std::move(reply));
gab 2017/02/07 15:46:08 #include <utility> for std::move
tzik 2017/02/08 01:39:32 Done.
54 } 53 }
55 54
56 TaskRunner::TaskRunner() {} 55 TaskRunner::TaskRunner() {}
57 56
58 TaskRunner::~TaskRunner() {} 57 TaskRunner::~TaskRunner() {}
59 58
60 void TaskRunner::OnDestruct() const { 59 void TaskRunner::OnDestruct() const {
61 delete this; 60 delete this;
62 } 61 }
63 62
64 void TaskRunnerTraits::Destruct(const TaskRunner* task_runner) { 63 void TaskRunnerTraits::Destruct(const TaskRunner* task_runner) {
65 task_runner->OnDestruct(); 64 task_runner->OnDestruct();
66 } 65 }
67 66
68 } // namespace base 67 } // namespace base
OLDNEW
« no previous file with comments | « base/task_runner.h ('k') | base/task_runner_util.h » ('j') | base/task_runner_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698