Chromium Code Reviews| Index: content/public/browser/browser_thread.h |
| diff --git a/content/public/browser/browser_thread.h b/content/public/browser/browser_thread.h |
| index fe82220c1e58fd5c0ed6c5c3f234efe46c276afe..2e36131a90bfe36e29f94ad5376915df4d07d4a9 100644 |
| --- a/content/public/browser/browser_thread.h |
| +++ b/content/public/browser/browser_thread.h |
| @@ -142,14 +142,31 @@ class CONTENT_EXPORT BrowserThread { |
| static bool PostTaskAndReplyWithResult( |
| ID identifier, |
| const tracked_objects::Location& from_here, |
| - base::Callback<ReturnType()> task, |
| - base::Callback<void(ReplyArgType)> reply) { |
| + base::OnceCallback<ReturnType()> task, |
| + base::OnceCallback<void(ReplyArgType)> reply) { |
| scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| GetTaskRunnerForThread(identifier); |
| return base::PostTaskAndReplyWithResult(task_runner.get(), from_here, |
| std::move(task), std::move(reply)); |
| } |
| + // Callback version of PostTaskAndReplyWithResult above. |
| + // Though RepeatingCallback is convertible to OnceCallback, we need this since |
| + // we can not use template deduction and object conversion at once on the |
| + // overload resolution. |
| + // TODO(tzik): Update all callers of the Callback version to use OnceCallback. |
|
kinuko
2017/05/01 04:48:47
nit: link to the issue?
tzik
2017/05/01 05:13:01
Done.
|
| + template <typename ReturnType, typename ReplyArgType> |
| + static bool PostTaskAndReplyWithResult( |
| + ID identifier, |
| + const tracked_objects::Location& from_here, |
| + base::Callback<ReturnType()> task, |
| + base::Callback<void(ReplyArgType)> reply) { |
| + return PostTaskAndReplyWithResult( |
| + identifier, from_here, |
| + static_cast<base::OnceCallback<ReturnType()>>(std::move(task)), |
| + static_cast<base::OnceCallback<void(ReplyArgType)>>(std::move(reply))); |
| + } |
| + |
| template <class T> |
| static bool DeleteSoon(ID identifier, |
| const tracked_objects::Location& from_here, |