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/run_loop.hpp | 9 -------- include/mbgl/util/work_task.hpp | 3 --- include/mbgl/util/work_task_impl.hpp | 44 ------------------------------------ 3 files changed, 56 deletions(-) (limited to 'include') diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index 1804fb12bd..14352ca823 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -63,15 +63,6 @@ public: return std::make_unique(task); } - // Invoke fn(args...) on this RunLoop, then invoke callback(results...) on the current RunLoop. - template - std::unique_ptr - invokeWithCallback(Fn&& fn, Args&&... args) { - std::shared_ptr task = WorkTask::makeWithCallback(std::forward(fn), std::forward(args)...); - push(task); - return std::make_unique(task); - } - class Impl; private: diff --git a/include/mbgl/util/work_task.hpp b/include/mbgl/util/work_task.hpp index dda8e5d00f..f2dcfcfe86 100644 --- a/include/mbgl/util/work_task.hpp +++ b/include/mbgl/util/work_task.hpp @@ -18,9 +18,6 @@ public: template static std::shared_ptr make(Fn&&, Args&&...); - - template - static std::shared_ptr makeWithCallback(Fn&&, Args&&...); }; } // namespace mbgl 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