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

Side by Side Diff: base/post_task_and_reply_with_result_internal.h

Issue 2535843002: Move PostTaskAndReplyWithResult() adapters to a separate header. (Closed)
Patch Set: add missing header Created 4 years 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
« no previous file with comments | « base/BUILD.gn ('k') | base/task/cancelable_task_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
6 #define BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
7
8 #include <utility>
9
10 #include "base/callback.h"
11
12 namespace base {
13
14 namespace internal {
15
16 // Adapts a function that produces a result via a return value to
17 // one that returns via an output parameter.
18 template <typename ReturnType>
19 void ReturnAsParamAdapter(const Callback<ReturnType(void)>& func,
20 ReturnType* result) {
21 *result = func.Run();
22 }
23
24 // Adapts a T* result to a callblack that expects a T.
25 template <typename TaskReturnType, typename ReplyArgType>
26 void ReplyAdapter(const Callback<void(ReplyArgType)>& callback,
27 TaskReturnType* result) {
28 callback.Run(std::move(*result));
29 }
30
31 } // namespace internal
32
33 } // namespace base
34
35 #endif // BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/task/cancelable_task_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698