From 2425cf4ef839bbeec82403ea0bf8b74e68ca0ac8 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Wed, 6 Jul 2016 17:35:01 +0300 Subject: [PATCH] Revert "[android] Do not create Timers on Default main loops" This reverts commit 13cd75f099c92b6f0862db00eee8ff4a78a73316. --- platform/android/src/run_loop.cpp | 2 -- platform/android/src/run_loop_impl.hpp | 1 - platform/android/src/timer.cpp | 2 -- test/util/timer.cpp | 12 ++++++------ 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp index af85ab42d..886dcab89 100644 --- a/platform/android/src/run_loop.cpp +++ b/platform/android/src/run_loop.cpp @@ -80,8 +80,6 @@ RunLoop::Impl::Impl(RunLoop* runLoop_, RunLoop::Type type) : runLoop(runLoop_) { case Type::Default: ret = ALooper_addFd(loop, fds[PIPE_OUT], ALOOPER_POLL_CALLBACK, ALOOPER_EVENT_INPUT, looperCallbackDefault, this); - running = true; - isDefaultLoop = true; break; } diff --git a/platform/android/src/run_loop_impl.hpp b/platform/android/src/run_loop_impl.hpp index 9622efb36..cb553d1f8 100644 --- a/platform/android/src/run_loop_impl.hpp +++ b/platform/android/src/run_loop_impl.hpp @@ -41,7 +41,6 @@ public: ALooper* loop = nullptr; RunLoop* runLoop = nullptr; util::Atomic running; - bool isDefaultLoop = false; private: friend RunLoop; diff --git a/platform/android/src/timer.cpp b/platform/android/src/timer.cpp index 6c0dc81ec..7057d6de7 100644 --- a/platform/android/src/timer.cpp +++ b/platform/android/src/timer.cpp @@ -3,7 +3,6 @@ #include #include -#include #include namespace mbgl { @@ -12,7 +11,6 @@ namespace util { class Timer::Impl : public RunLoop::Impl::Runnable { public: Impl() { - assert(!loop->isDefaultLoop); loop->initRunnable(this); } diff --git a/test/util/timer.cpp b/test/util/timer.cpp index c37440ed4..f6253ab6d 100644 --- a/test/util/timer.cpp +++ b/test/util/timer.cpp @@ -10,7 +10,7 @@ using namespace mbgl::util; TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Basic)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; Timer timer; @@ -34,7 +34,7 @@ TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Basic)) { } TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Repeat)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; Timer timer; @@ -60,7 +60,7 @@ TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Repeat)) { } TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Stop)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; Timer timer1; Timer timer2; @@ -96,7 +96,7 @@ TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(Stop)) { } TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(DestroyShouldStop)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; auto timer1 = std::make_unique(); Timer timer2; @@ -132,7 +132,7 @@ TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(DestroyShouldStop)) { } TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(StartOverrides)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; Timer timer; @@ -166,7 +166,7 @@ TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(StartOverrides)) { } TEST(Timer, TEST_REQUIRES_ACCURATE_TIMING(CanStopNonStartedTimer)) { - RunLoop loop(RunLoop::Type::New); + RunLoop loop; Timer timer; timer.stop();