Change pause/resume regarding update timer
authorYunchan Cho <yunchan.cho@samsung.com>
Wed, 1 May 2013 04:17:58 +0000 (13:17 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Thu, 2 May 2013 08:40:29 +0000 (17:40 +0900)
[Issue#] N/A
[Problem] When a livebox is paused, its timer regarding updating is deleted, not freezed
[Cause] In this case, web-provider has deleted the timer.
[Solution] web-provider pauses(resumes) the timer when it receives pause(resume) event of a livebox

Change-Id: Id419fc9f8b165223e7948ee222342601d8ac7f7c

src/Core/Box.cpp
src/Core/BoxUpdateTimer.cpp
src/Core/BoxUpdateTimer.h
src/Core/Util/ITimer.h

index 2e51dab..cefcce6 100644 (file)
@@ -140,7 +140,7 @@ bool Box::resume()
 
     try {
         m_currentTab = true;
-        m_updateTimer->start();
+        m_updateTimer->resume();
         m_view->resumeBox();
     } catch (...) {
         return false;
@@ -159,7 +159,7 @@ bool Box::pause(bool background)
         if (!background) {
             m_currentTab = false;
         }
-        m_updateTimer->stop();
+        m_updateTimer->pause();
         m_view->pauseBox();
     } catch (...) {
         return false;
@@ -219,10 +219,6 @@ bool Box::update()
 {
     LogD("enter");
 
-    if (!m_currentTab) {
-        return false;
-    }
-    // reload box
     m_boxBuffer->startCanvasUpdate();
     RenderInfoPtr renderInfo = makeRenderInfo(renderTypeUpdate);
     m_view->showBox(renderInfo);
index f2ed775..b503f89 100644 (file)
@@ -21,7 +21,7 @@
 #include <Core/Util/Log.h>
 #include "BoxUpdateTimer.h"
 
-#define UPDATE_TIME_MIN 10.0
+#define UPDATE_TIME_MIN 60.0
 
 BoxUpdateTimer::BoxUpdateTimer(float period, Ecore_Task_Cb callback, void* data)
     : m_period(period)
@@ -43,6 +43,10 @@ void BoxUpdateTimer::start()
         return;
     }
 
+    if (m_timer) {
+        stop();
+    }
+
     m_timer = ecore_timer_add(m_period, m_callback, m_data); 
 }
 
@@ -52,6 +56,18 @@ void BoxUpdateTimer::stop()
     m_timer = NULL;
 }
 
+void BoxUpdateTimer::resume()
+{
+    LogD("enter");
+    ecore_timer_thaw(m_timer);
+}
+
+void BoxUpdateTimer::pause()
+{
+    LogD("enter");
+    ecore_timer_freeze(m_timer);
+}
+
 void BoxUpdateTimer::restart()
 {
     if (m_timer) {
index e5e5582..655dd51 100644 (file)
@@ -31,6 +31,8 @@ class BoxUpdateTimer: public ITimer {
         };
         void start();
         void stop();
+        void resume();
+        void pause();
         void restart();
         void setPeriod(float period);
         ~BoxUpdateTimer();
index 7362b94..c6595cb 100644 (file)
@@ -26,6 +26,8 @@ class ITimer {
     public:
         virtual void start() = 0;
         virtual void stop() = 0;
+        virtual void resume() = 0;
+        virtual void pause() = 0;
         virtual void restart() = 0;
         virtual void setPeriod(float period) = 0;