From c3900e42d6b58eeb14c3246528f0517229bd51b9 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 21 Jun 2017 20:54:20 +0300 Subject: [core] Removed unused methods No longer needed after refactoring ::setResourceTransform. --- include/mbgl/util/work_task_impl.hpp | 44 ------------------------------------ 1 file changed, 44 deletions(-) (limited to 'include/mbgl/util/work_task_impl.hpp') diff --git a/include/mbgl/util/work_task_impl.hpp b/include/mbgl/util/work_task_impl.hpp index 8ebc7d45f8..276e0d6237 100644 --- a/include/mbgl/util/work_task_impl.hpp +++ b/include/mbgl/util/work_task_impl.hpp @@ -62,48 +62,4 @@ std::shared_ptr WorkTask::make(Fn&& fn, Args&&... args) { flag); } -namespace detail { -template -auto packageArgumentsAndCallback(std::shared_ptr> flag, - Tuple&& args, - std::index_sequence) { - auto callback = std::get(args); - - // Create a lambda L1 that invokes another lambda L2 on the current RunLoop R, that calls - // the callback C. Both lambdas check the flag before proceeding. L1 needs to check the flag - // because if the request was cancelled, then R might have been destroyed. L2 needs to check - // the flag because the request may have been cancelled after L2 was invoked but before it - // began executing. - - auto l2 = [flag, callback] (auto&&... results) { - if (!*flag) { - callback(std::forward(results)...); - } - }; - - auto l1 = [flag, current = util::RunLoop::Get(), l2_ = l2] (auto&&... results) { - if (!*flag) { - current->invoke(l2_, std::forward(results)...); - } - }; - - return std::make_tuple(std::get(std::forward(args))..., l1); -} -} // namespace detail - -template -std::shared_ptr WorkTask::makeWithCallback(Fn&& fn, Args&&... args) { - auto flag = std::make_shared>(); - *flag = false; - - auto tuple = detail::packageArgumentsAndCallback(flag, - std::forward_as_tuple(std::forward(args)...), - std::make_index_sequence()); - - return std::make_shared, decltype(tuple)>>( - std::forward(fn), - std::move(tuple), - flag); -} - } // namespace mbgl -- cgit v1.2.1