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

Side by Side Diff: base/task_runner_util.h

Issue 2791243002: Rewrite base::Bind into base::BindOnce on trivial cases in base (Closed)
Patch Set: rebase Created 3 years, 8 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 #ifndef BASE_TASK_RUNNER_UTIL_H_ 5 #ifndef BASE_TASK_RUNNER_UTIL_H_
6 #define BASE_TASK_RUNNER_UTIL_H_ 6 #define BASE_TASK_RUNNER_UTIL_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 21 matching lines...) Expand all
32 // Bind(&Callback)); 32 // Bind(&Callback));
33 template <typename TaskReturnType, typename ReplyArgType> 33 template <typename TaskReturnType, typename ReplyArgType>
34 bool PostTaskAndReplyWithResult(TaskRunner* task_runner, 34 bool PostTaskAndReplyWithResult(TaskRunner* task_runner,
35 const tracked_objects::Location& from_here, 35 const tracked_objects::Location& from_here,
36 Callback<TaskReturnType()> task, 36 Callback<TaskReturnType()> task,
37 Callback<void(ReplyArgType)> reply) { 37 Callback<void(ReplyArgType)> reply) {
38 DCHECK(task); 38 DCHECK(task);
39 DCHECK(reply); 39 DCHECK(reply);
40 TaskReturnType* result = new TaskReturnType(); 40 TaskReturnType* result = new TaskReturnType();
41 return task_runner->PostTaskAndReply( 41 return task_runner->PostTaskAndReply(
42 from_here, base::Bind(&internal::ReturnAsParamAdapter<TaskReturnType>, 42 from_here,
43 std::move(task), result), 43 base::BindOnce(&internal::ReturnAsParamAdapter<TaskReturnType>,
44 base::Bind(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>, 44 std::move(task), result),
45 std::move(reply), base::Owned(result))); 45 base::BindOnce(&internal::ReplyAdapter<TaskReturnType, ReplyArgType>,
46 std::move(reply), base::Owned(result)));
46 } 47 }
47 48
48 } // namespace base 49 } // namespace base
49 50
50 #endif // BASE_TASK_RUNNER_UTIL_H_ 51 #endif // BASE_TASK_RUNNER_UTIL_H_
OLDNEW
« no previous file with comments | « base/task/cancelable_task_tracker_unittest.cc ('k') | base/task_scheduler/delayed_task_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698