diff options
author | Chris Warren-Smith | 2013-06-25 21:08:55 +1000 |
---|---|---|
committer | Chris Warren-Smith | 2013-07-03 07:04:11 +1000 |
commit | be399188c4ec25463c4a777a5e96fd69a4b0b1e3 (patch) | |
tree | 9ddd2345eb54db92ad8d35eaa47545431f7c0d40 /backends/timer | |
parent | 5f3ddae421c473fc7e1a02f9c068900c12147b2a (diff) | |
download | scummvm-rg350-be399188c4ec25463c4a777a5e96fd69a4b0b1e3.tar.gz scummvm-rg350-be399188c4ec25463c4a777a5e96fd69a4b0b1e3.tar.bz2 scummvm-rg350-be399188c4ec25463c4a777a5e96fd69a4b0b1e3.zip |
TIZEN: bada port updated to tizen
Diffstat (limited to 'backends/timer')
-rw-r--r-- | backends/timer/tizen/timer.cpp (renamed from backends/timer/bada/timer.cpp) | 50 | ||||
-rw-r--r-- | backends/timer/tizen/timer.h (renamed from backends/timer/bada/timer.h) | 23 |
2 files changed, 36 insertions, 37 deletions
diff --git a/backends/timer/bada/timer.cpp b/backends/timer/tizen/timer.cpp index e41ecd4864..fa226ce747 100644 --- a/backends/timer/bada/timer.cpp +++ b/backends/timer/tizen/timer.cpp @@ -20,15 +20,14 @@ * */ -#if defined(BADA) +#if defined(TIZEN) -#include "backends/timer/bada/timer.h" +#include "backends/timer/tizen/timer.h" // -// TimerSlot +// TimerSlot - an event driven thread // -TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback, - uint32 interval, void *refCon) : +TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback, uint32 interval, void *refCon) : _timer(0), _callback(callback), _interval(interval), @@ -36,16 +35,17 @@ TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback, } TimerSlot::~TimerSlot() { + delete _timer; } bool TimerSlot::OnStart() { - _timer = new Osp::Base::Runtime::Timer(); + _timer = new Tizen::Base::Runtime::Timer(); if (!_timer || IsFailed(_timer->Construct(*this))) { AppLog("Failed to create timer"); return false; } - if (IsFailed(_timer->Start(_interval))) { + if (IsFailed(_timer->StartAsRepeatable(_interval))) { AppLog("failed to start timer"); return false; } @@ -65,28 +65,28 @@ void TimerSlot::OnStop() { void TimerSlot::OnTimerExpired(Timer &timer) { _callback(_refCon); - timer.Start(_interval); } // -// BadaTimerManager +// TizenTimerManager // -BadaTimerManager::BadaTimerManager() { +TizenTimerManager::TizenTimerManager() { } -BadaTimerManager::~BadaTimerManager() { - for (Common::List<TimerSlot>::iterator slot = _timers.begin(); - slot != _timers.end(); ) { - slot->Stop(); - slot = _timers.erase(slot); +TizenTimerManager::~TizenTimerManager() { + for (Common::List<TimerSlot *>::iterator it = _timers.begin(); it != _timers.end(); ) { + TimerSlot *slot = (*it); + slot->Quit(); + slot->Join(); + delete slot; + it = _timers.erase(it); } } -bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon, - const Common::String &id) { +bool TizenTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id) { TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon); - if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) { + if (IsFailed(slot->Construct())) { AppLog("Failed to create timer thread"); delete slot; return false; @@ -98,16 +98,18 @@ bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *re return false; } - _timers.push_back(*slot); + _timers.push_back(slot); return true; } -void BadaTimerManager::removeTimerProc(TimerProc proc) { - for (Common::List<TimerSlot>::iterator slot = _timers.begin(); - slot != _timers.end(); ++slot) { +void TizenTimerManager::removeTimerProc(TimerProc proc) { + for (Common::List<TimerSlot *>::iterator it = _timers.begin(); it != _timers.end(); ++it) { + TimerSlot *slot = (*it); if (slot->_callback == proc) { - slot->Stop(); - slot = _timers.erase(slot); + slot->Quit(); + slot->Join(); + delete slot; + it = _timers.erase(it); } } } diff --git a/backends/timer/bada/timer.h b/backends/timer/tizen/timer.h index 826064d7ff..4b2596401a 100644 --- a/backends/timer/bada/timer.h +++ b/backends/timer/tizen/timer.h @@ -20,20 +20,18 @@ * */ -#ifndef BADA_TIMER_H -#define BADA_TIMER_H +#ifndef TIZEN_TIMER_H +#define TIZEN_TIMER_H #include <FBase.h> #include "common/timer.h" #include "common/list.h" -using namespace Osp::Base::Runtime; +using namespace Tizen::Base::Runtime; -struct TimerSlot: public ITimerEventListener, public Thread { - TimerSlot(Common::TimerManager::TimerProc callback, - uint32 interval, - void *refCon); +struct TimerSlot: public EventDrivenThread, public ITimerEventListener { + TimerSlot(Common::TimerManager::TimerProc callback, uint32 interval, void *refCon); ~TimerSlot(); bool OnStart(void); @@ -46,17 +44,16 @@ struct TimerSlot: public ITimerEventListener, public Thread { void *_refCon; }; -class BadaTimerManager : public Common::TimerManager { +class TizenTimerManager : public Common::TimerManager { public: - BadaTimerManager(); - ~BadaTimerManager(); + TizenTimerManager(); + ~TizenTimerManager(); - bool installTimerProc(TimerProc proc, int32 interval, void *refCon, - const Common::String &id); + bool installTimerProc(TimerProc proc, int32 interval, void *refCon, const Common::String &id); void removeTimerProc(TimerProc proc); private: - Common::List<TimerSlot> _timers; + Common::List<TimerSlot *> _timers; }; #endif |