From 43059b18787cda6dfb6b13b90af276930c52d6d1 Mon Sep 17 00:00:00 2001
From: Chris Warren-Smith <cwarrensmith@gmail.com>
Date: Sat, 20 Aug 2011 10:41:32 +1000
Subject: [PATCH] BADA: Moved timer manager to backends/timer/bada

---
 backends/module.mk                          |  5 +++++
 backends/platform/bada/system.cpp           |  2 +-
 backends/{platform => timer}/bada/timer.cpp | 17 ++++++-----------
 backends/{platform => timer}/bada/timer.h   |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)
 rename backends/{platform => timer}/bada/timer.cpp (89%)
 rename backends/{platform => timer}/bada/timer.h (96%)

diff --git a/backends/module.mk b/backends/module.mk
index 7a8aab8b6a7..e38b039aa20 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -117,6 +117,11 @@ MODULE_OBJS += \
 	mixer/sdl13/sdl13-mixer.o
 endif
 
+ifeq ($(BACKEND),bada)
+MODULE_OBJS += \
+	timer/bada/timer.o
+endif
+
 ifeq ($(BACKEND),ds)
 MODULE_OBJS += \
 	fs/ds/ds-fs.o \
diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp
index 33318a1e61d..4503b8fa6b3 100755
--- a/backends/platform/bada/system.cpp
+++ b/backends/platform/bada/system.cpp
@@ -33,12 +33,12 @@
 #include "backends/audiocd/default/default-audiocd.h"
 #include "backends/mutex/mutex.h"
 #include "backends/fs/fs-factory.h"
+#include "backends/timer/bada/timer.h"
 
 #include "backends/platform/bada/form.h"
 #include "backends/platform/bada/system.h"
 #include "backends/platform/bada/graphics.h"
 #include "backends/platform/bada/audio.h"
-#include "backends/platform/bada/timer.h"
 
 using namespace Osp::Base;
 using namespace Osp::Base::Runtime;
diff --git a/backends/platform/bada/timer.cpp b/backends/timer/bada/timer.cpp
similarity index 89%
rename from backends/platform/bada/timer.cpp
rename to backends/timer/bada/timer.cpp
index b98af897f8d..8f5620401f4 100755
--- a/backends/platform/bada/timer.cpp
+++ b/backends/timer/bada/timer.cpp
@@ -20,8 +20,9 @@
  *
  */
 
-#include "backends/platform/bada/timer.h"
-#include "backends/platform/bada/system.h"
+#if defined (BADA)
+
+#include "backends/timer/bada/timer.h"
 
 //
 // TimerSlot
@@ -32,16 +33,12 @@ TimerSlot::TimerSlot(Common::TimerManager::TimerProc callback,
 	_callback(callback),
 	_interval(interval),
 	_refCon(refCon) {
-	logEntered();
 }
 
 TimerSlot::~TimerSlot() {
-	logEntered();
 }
 
 bool TimerSlot::OnStart() {
-	logEntered();
-
 	_timer = new Osp::Base::Runtime::Timer();
 	if (!_timer || IsFailed(_timer->Construct(*this))) {
 		AppLog("Failed to create timer");
@@ -58,7 +55,7 @@ bool TimerSlot::OnStart() {
 }
 
 void TimerSlot::OnStop() {
-	logEntered();
+	AppLog("timer stopped");
 	if (_timer) {
 		_timer->Cancel();		 
 		delete _timer;
@@ -75,11 +72,9 @@ void TimerSlot::OnTimerExpired(Timer &timer) {
 // BadaTimerManager
 //
 BadaTimerManager::BadaTimerManager() {
-	logEntered();
 }
 
 BadaTimerManager::~BadaTimerManager() {
-	logEntered();
 	for (Common::List<TimerSlot>::iterator slot = _timers.begin();
 			 slot != _timers.end(); ++slot) {
 		slot->Stop();
@@ -89,7 +84,6 @@ BadaTimerManager::~BadaTimerManager() {
 
 bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *refCon,
 																				const Common::String &id) {
-	logEntered();
 	TimerSlot *slot = new TimerSlot(proc, interval / 1000, refCon);
 
 	if (IsFailed(slot->Construct(THREAD_TYPE_EVENT_DRIVEN))) {
@@ -109,7 +103,6 @@ bool BadaTimerManager::installTimerProc(TimerProc proc, int32 interval, void *re
 }
 
 void BadaTimerManager::removeTimerProc(TimerProc proc) {
-	logEntered();
 	for (Common::List<TimerSlot>::iterator slot = _timers.begin();
 			 slot != _timers.end(); ++slot) {
 		if (slot->_callback == proc) {
@@ -118,3 +111,5 @@ void BadaTimerManager::removeTimerProc(TimerProc proc) {
 		}
 	}
 }
+
+#endif
diff --git a/backends/platform/bada/timer.h b/backends/timer/bada/timer.h
similarity index 96%
rename from backends/platform/bada/timer.h
rename to backends/timer/bada/timer.h
index f9ed32c8016..04ca771c26f 100755
--- a/backends/platform/bada/timer.h
+++ b/backends/timer/bada/timer.h
@@ -55,7 +55,7 @@ public:
 												const Common::String &id);
 	void removeTimerProc(TimerProc proc);
 
- private:
+private:
 	Common::List<TimerSlot> _timers;
 };