| Index: base/post_task_and_reply_with_result_internal.h
|
| diff --git a/base/post_task_and_reply_with_result_internal.h b/base/post_task_and_reply_with_result_internal.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1456129324a55dd80b90124895c110bde5d735d5
|
| --- /dev/null
|
| +++ b/base/post_task_and_reply_with_result_internal.h
|
| @@ -0,0 +1,35 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
|
| +#define BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
|
| +
|
| +#include <utility>
|
| +
|
| +#include "base/callback.h"
|
| +
|
| +namespace base {
|
| +
|
| +namespace internal {
|
| +
|
| +// Adapts a function that produces a result via a return value to
|
| +// one that returns via an output parameter.
|
| +template <typename ReturnType>
|
| +void ReturnAsParamAdapter(const Callback<ReturnType(void)>& func,
|
| + ReturnType* result) {
|
| + *result = func.Run();
|
| +}
|
| +
|
| +// Adapts a T* result to a callblack that expects a T.
|
| +template <typename TaskReturnType, typename ReplyArgType>
|
| +void ReplyAdapter(const Callback<void(ReplyArgType)>& callback,
|
| + TaskReturnType* result) {
|
| + callback.Run(std::move(*result));
|
| +}
|
| +
|
| +} // namespace internal
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // BASE_POST_TASK_AND_REPLY_WITH_RESULT_INTERNAL_H_
|
|
|