remove mis-typo
[platform/framework/native/uifw.git] / src / ui / animations / FUiAnim_AnimationManager.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiAnim_AnimationManager.cpp
20  * @brief       This file contains implementation of _AnimationManager class
21  *
22  * This file contains implementation _AnimationManager class.
23  */
24
25 #include <Ecore.h>
26
27 #include <FBaseSysLog.h>
28
29 #include <FUiAnimLinearTimingFunction.h>
30 #include <FUiAnimVisualElementPropertyAnimation.h>
31 #include <FUiAnimVisualElement.h>
32 #include <FUiAnimIAnimationTransactionEventListener.h>
33
34 #include "FUi_EcoreEvas.h"
35 #include "FUi_EcoreEvasMgr.h"
36
37 #include "FUiAnim_RootVisualElement.h"
38 #include "FUiAnim_VisualElementImpl.h"
39 #include "FUiAnim_VisualElementAnimationImpl.h"
40 #include "FUiAnim_TransactionNode.h"
41 #include "FUiAnim_AnimationGroupNode.h"
42 #include "FUiAnim_VisualElementAnimationVariantInterpolator.h"
43 #include "FUiAnim_AnimationManager.h"
44 #include "FUiAnim_DisplayManager.h"
45
46
47 Ecore_Animator* pAnimator = null;
48
49 Eina_Bool
50 __AnimatorCallback(void* pData)
51 {
52 #ifndef VE_VSYNC_UPDATE
53         pAnimationManager->ProcessAnimationTick();
54 #endif
55
56         return EINA_TRUE;
57 }
58
59 namespace Tizen { namespace Ui { namespace Animations
60 {
61
62 // default transaction event listener
63 class _TransactionEventListener
64         : public IAnimationTransactionEventListener
65         , virtual public Tizen::Base::Runtime::IEventListener
66 {
67 public:
68         _TransactionEventListener(void);
69         virtual ~_TransactionEventListener(void);
70
71         void SetTransactionEventListener(const IAnimationTransactionEventListener* pListener);
72
73         virtual void OnAnimationTransactionStarted(int transactionId);
74         virtual void OnAnimationTransactionStopped(int transactionId);
75         virtual void OnAnimationTransactionFinished(int transactionId);
76
77 private:
78         IAnimationTransactionEventListener* __pEventListener;
79 };
80
81 _TransactionEventListener::_TransactionEventListener(void)
82         : __pEventListener(null)
83 {
84 }
85
86 _TransactionEventListener::~_TransactionEventListener(void)
87 {
88 }
89
90 void
91 _TransactionEventListener::SetTransactionEventListener(const IAnimationTransactionEventListener* pListener)
92 {
93         __pEventListener = const_cast< IAnimationTransactionEventListener* >(pListener);
94 }
95
96 void
97 _TransactionEventListener::OnAnimationTransactionStarted(int transactionId)
98 {
99         if (__pEventListener)
100         {
101                 __pEventListener->OnAnimationTransactionStarted(transactionId);
102         }
103 }
104
105 void
106 _TransactionEventListener::OnAnimationTransactionStopped(int transactionId)
107 {
108         if (__pEventListener)
109         {
110                 __pEventListener->OnAnimationTransactionStopped(transactionId);
111         }
112 }
113
114 void
115 _TransactionEventListener::OnAnimationTransactionFinished(int transactionId)
116 {
117         if (__pEventListener)
118         {
119                 __pEventListener->OnAnimationTransactionFinished(transactionId);
120         }
121 }
122
123 _AnimationManager* _AnimationManager::__pInstance = null;
124
125 _AnimationManager::_AnimationManager(void)
126         : __isAnimating(false)
127         , __isInAnimationTick(false)
128         , __pRootTransaction(null)
129         , __pCurrentTransaction(null)
130         , __pCurrentTransactionExceptGroup(null)
131         , __pDefaultTransactionEventListener(null)
132         , __pDefaultTimingFunction(null)
133         , __pDefaultInterpolator(null)
134 {
135
136 }
137
138 _AnimationManager::~_AnimationManager(void)
139 {
140
141 }
142
143 _AnimationManager*
144 _AnimationManager::GetInstance(void)
145 {
146         return __pInstance;
147 }
148
149 result
150 _AnimationManager::CreateInstance(void)
151 {
152         SysAssertf((__pInstance == null), "Already created.");
153
154         __pInstance = new (std::nothrow) _AnimationManager();
155         SysTryReturnResult(NID_UI_ANIM, __pInstance != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
156
157         result r = __pInstance->Construct();
158         if (r != E_SUCCESS)
159         {
160                 SysLogException(NID_UI_ANIM, r, "[%s] Failed to construct _AnimationManager instance.", GetErrorMessage(r));
161
162                 delete __pInstance;
163                 __pInstance = null;
164
165                 return null;
166         }
167
168         return E_SUCCESS;
169 }
170
171 void
172 _AnimationManager::ReleaseInstance(void)
173 {
174         if (__pInstance != null)
175         {
176                 __pInstance->Release();
177
178                 delete __pInstance;
179                 __pInstance = null;
180         }
181 }
182
183 result
184 _AnimationManager::Release(void)
185 {
186         if (pAnimator)
187         {
188                 ecore_animator_del(pAnimator);
189                 pAnimator = null;
190         }
191
192         if (__pCurrentTransaction)
193         {
194                 delete __pCurrentTransaction;
195                 __pCurrentTransaction = null;
196         }
197
198         __committedList.RemoveAllNodes();
199
200         delete __pRootTransaction;
201         __pRootTransaction = null;
202
203         delete __pDefaultTransactionEventListener;
204         __pDefaultTransactionEventListener = null;
205
206         delete __pDefaultTimingFunction;
207         __pDefaultTimingFunction = null;
208
209         delete __pDefaultInterpolator;
210         __pDefaultInterpolator = null;
211
212         return E_SUCCESS;
213 }
214
215 result
216 _AnimationManager::Construct(void)
217 {
218         result r = E_SUCCESS;
219
220         __committedList.Construct();
221
222         __pRootTransaction = new (std::nothrow) _TransactionNode();
223         SysTryReturnResult(NID_UI_ANIM, (__pRootTransaction != null), E_OUT_OF_MEMORY, "Memory allocation failed. Failed to create root transaction");
224
225         r = GetLastResult();
226         SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), , r, "[%s] Failed to create root transaction.", GetErrorMessage(r));
227
228         __pRootTransaction->Commit();   //root is always committed.
229
230         __pDefaultTransactionEventListener = new (std::nothrow) _TransactionEventListener();
231         SysTryCatch(NID_UI_ANIM, __pDefaultTransactionEventListener != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
232                 "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create default transaction event listener.");
233
234         __pDefaultTimingFunction = new (std::nothrow) LinearTimingFunction();
235         SysTryCatch(NID_UI_ANIM, __pDefaultTimingFunction != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
236                 "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create default timing function map.");
237
238         __pDefaultInterpolator = new (std::nothrow) _VisualElementAnimationVariantInterpolator();
239         SysTryCatch(NID_UI_ANIM, __pDefaultInterpolator != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
240                 "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create default interpolator.");
241
242         return E_SUCCESS;
243
244 CATCH:
245         delete __pRootTransaction;
246         delete __pDefaultTransactionEventListener;
247         delete __pDefaultTimingFunction;
248         delete __pDefaultInterpolator;
249
250         return r;
251 }
252
253 void
254 _AnimationManager::SetAnimatorEnabled(bool animating)
255 {
256 #ifdef VE_VSYNC_UPDATE
257         __isAnimating = animating;
258
259         if (likely(animating))
260         {
261                 if (likely(pAnimator == null))
262                 {
263                         pAnimator = (Ecore_Animator*)ecore_animator_add(__AnimatorCallback, _AnimationManager::GetInstance());
264                 }
265         }
266         else
267         {
268                 if (pAnimator)
269                 {
270                         ecore_animator_del(pAnimator);
271                         pAnimator = null;
272                 }
273         }
274 #else
275         if (animating)
276         {
277                 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
278                 if (pDisplayManager)
279                 {
280                         pDisplayManager->AddWakeUpEvent();
281                 }
282         }
283 #endif
284 }
285
286 result
287 _AnimationManager::AddAnimation(VisualElement& target, const Tizen::Base::String* pKeyName, VisualElementAnimation& animation)
288 {
289         SysTryReturnResult(NID_UI_ANIM, (CreateCurrentTransactionIfNeeded() == true), E_SYSTEM, "A system error has been occurred. Current transaction is null.");
290
291         if (pKeyName != null && pKeyName->IsEmpty() == false)
292         {
293                 SysTryReturnResult(NID_UI_ANIM, (DoesAnimationExist(target, *pKeyName) == false), E_OBJ_ALREADY_EXIST, "Animation with keyName already exists. key name = %ls", pKeyName->GetPointer());
294         }
295
296         result r = E_SUCCESS;
297
298         if (_VisualElementAnimationImpl::GetInstance(animation)->GetTimingFunction() == null)
299         {
300                 animation.SetTimingFunction(__pDefaultTimingFunction);
301         }
302
303         if (_VisualElementAnimationImpl::GetInstance(animation)->GetValueInterpolator() == null)
304         {
305                 animation.SetValueInterpolator(__pDefaultInterpolator);
306         }
307
308         // current trasaction
309         r = __pCurrentTransaction->AddAnimation(target, pKeyName, animation);
310         SysTryReturnResult(NID_UI_ANIM, r == E_SUCCESS, r, "Failed to add animation.");
311
312         if (__pCurrentTransaction->IsCommitted() && __isAnimating == false)
313         {
314                 SetAnimatorEnabled(true);
315         }
316
317         return E_SUCCESS;
318 }
319
320 result
321 _AnimationManager::RemoveAnimation(VisualElement& target, const Tizen::Base::String& keyName)
322 {
323         result r = E_SUCCESS;
324
325         if (__pCurrentTransaction)
326         {
327                 r = __pCurrentTransaction->RemoveChildrenAnimation(target, keyName);
328
329                 if (r == E_SUCCESS)
330                 {
331                         return r;
332                 }
333         }
334
335         if (__committedList.IsEmpty() == false)
336         {
337                 int committedCount = __committedList.GetCount();
338
339                 _TransactionNode* pNode = null;
340
341                 for(int index = 0; index < committedCount; index++)
342                 {
343                         pNode = __committedList.GetNodeAt(index);
344
345                         if (pNode)
346                         {
347                                 r = pNode->RemoveChildrenAnimation(target, keyName);
348
349                                 if (r == E_SUCCESS)
350                                 {
351                                         return r;
352                                 }
353                         }
354                 }
355         }
356
357         return __pRootTransaction->RemoveChildrenAnimation(target, keyName);
358 }
359
360 void
361 _AnimationManager::RemoveAnimationByProperty(VisualElement& target, const Tizen::Base::String& property)
362 {
363         if (__pCurrentTransaction)
364         {
365                 __pCurrentTransaction->RemoveChildrenAnimationByProperty(target, property);
366         }
367
368         if (__committedList.IsEmpty() == false)
369         {
370                 int committedCount = __committedList.GetCount();
371
372                 _TransactionNode* pNode = null;
373
374                 for(int index = 0; index < committedCount; index++)
375                 {
376                         pNode = __committedList.GetNodeAt(index);
377
378                         if (pNode)
379                         {
380                                 pNode->RemoveChildrenAnimationByProperty(target, property);
381                         }
382                 }
383         }
384
385         __pRootTransaction->RemoveChildrenAnimationByProperty(target, property);
386 }
387
388 void
389 _AnimationManager::RemoveAllAnimations(VisualElement& target)
390 {
391         if (__pCurrentTransaction)
392         {
393                 __pCurrentTransaction->RemoveChildrenAllAnimations(target);
394         }
395
396         if (__committedList.IsEmpty() == false)
397         {
398                 int committedCount = __committedList.GetCount();
399
400                 _TransactionNode* pNode = null;
401
402                 for(int index = 0; index < committedCount; index++)
403                 {
404                         pNode = __committedList.GetNodeAt(index);
405
406                         if (pNode)
407                         {
408                                 pNode->RemoveChildrenAllAnimations(target);
409                         }
410                 }
411         }
412
413         __pRootTransaction->RemoveChildrenAllAnimations(target);
414 }
415
416 const VisualElementAnimation*
417 _AnimationManager::GetAnimation(VisualElement& target, const Tizen::Base::String& keyName) const
418 {
419         const VisualElementAnimation* pAnimation = null;
420
421         if (__pCurrentTransaction)
422         {
423                 pAnimation = __pCurrentTransaction->GetChildrenAnimation(target, keyName);
424
425                 if (pAnimation)
426                 {
427                         return pAnimation;
428                 }
429         }
430
431         if (__committedList.IsEmpty() == false)
432         {
433                 int committedCount = __committedList.GetCount();
434
435                 _TransactionNode* pNode = null;
436
437                 for(int index = 0; index < committedCount; index++)
438                 {
439                         pNode = __committedList.GetNodeAt(index);
440
441                         if (pNode)
442                         {
443                                 pAnimation = pNode->GetChildrenAnimation(target, keyName);
444
445                                 if (pAnimation)
446                                 {
447                                         return pAnimation;
448                                 }
449                         }
450                 }
451         }
452
453         return __pRootTransaction->GetChildrenAnimation(target, keyName);
454 }
455
456 VisualElementAnimation*
457 _AnimationManager::GetAnimationN(VisualElement& target, const Tizen::Base::String& keyName) const
458 {
459         const VisualElementAnimation* pAnimation = GetAnimation(target, keyName);
460
461         if (pAnimation != null)
462         {
463                 SetLastResult(E_SUCCESS);
464                 return pAnimation->CloneN();
465         }
466
467         SetLastResult(E_OBJ_NOT_FOUND);
468         return null;
469 }
470
471 bool
472 _AnimationManager::DoesAnimationExist(VisualElement& target, const Tizen::Base::String& keyName) const
473 {
474         return (GetAnimation(target, keyName) != null);
475 }
476
477 int
478 _AnimationManager::BeginTransaction(void)
479 {
480         CommitCurrentTransactionIfNeeded();
481
482         _TransactionNode* pNode = null;
483
484         if (__pCurrentTransaction == null)
485         {
486                 pNode = new (std::nothrow) _TransactionNode(*__pRootTransaction);
487                 SysTryReturn(NID_UI_ANIM, (pNode != null), -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create _TransactionNode.");
488
489                 result r = GetLastResult();
490                 SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), , r, "[%s] Failed to create _TransactionNode instance.", GetErrorMessage(r));
491         }
492         else
493         {
494                 pNode = new (std::nothrow) _TransactionNode(*__pCurrentTransaction);
495                 SysTryReturn(NID_UI_ANIM, (pNode != null), -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create _TransactionNode.");
496
497                 result r = GetLastResult();
498                 SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), , r, "[%s] Failed to create _TransactionNode instance.", GetErrorMessage(r));
499
500                 r = __pCurrentTransaction->AddChild(*pNode);
501                 SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), , r, "[%s] Failed to add child.", GetErrorMessage(r));
502         }
503
504         __pCurrentTransaction = pNode;
505         __pCurrentTransactionExceptGroup = pNode;
506
507         pNode->SetDefaultEventListener(__pDefaultTransactionEventListener);
508
509         return pNode->GetId();
510
511 CATCH:
512         delete pNode;
513
514         return -1;
515 }
516
517 int
518 _AnimationManager::BeginGroupTransaction(VisualElement& target, const Tizen::Base::String* pKeyName, VisualElementAnimation& animation)
519 {
520         SysTryReturn(NID_UI_ANIM, (CreateCurrentTransactionIfNeeded() == true), -1, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Current transaction is null.");
521
522         if (pKeyName != null && pKeyName->IsEmpty() == false)
523         {
524                 SysTryReturn(NID_UI_ANIM, (DoesAnimationExist(target, *pKeyName) == false), -1, E_OBJ_ALREADY_EXIST, "[E_OBJ_ALREADY_EXIST] Animation with keyName already exists. key name = %ls", pKeyName->GetPointer());
525         }
526
527         _AnimationGroupNode* pNode = new (std::nothrow) _AnimationGroupNode(target, pKeyName, animation);
528         SysTryReturn(NID_UI_ANIM, (pNode != null), -1, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create _AnimationNode.");
529
530         result r = GetLastResult();
531         SysTryCatch(NID_UI_ANIM, (r == E_SUCCESS), , r, "[%s] Failed to _AnimationGroupNode instance.", GetErrorMessage(r));
532
533         r = __pCurrentTransaction->AddChild(*pNode);
534         SysTryCatch(NID_UI_ANIM, r == E_SUCCESS, , r, "[%s] Failed to add a child.", GetErrorMessage(r));
535
536         __pCurrentTransaction = pNode;
537
538         return pNode->GetId();
539
540 CATCH:
541
542         delete pNode;
543
544         return -1;
545 }
546
547 result
548 _AnimationManager::CommitTransaction(void)
549 {
550         SysTryReturnResult(NID_UI_ANIM, __pCurrentTransaction != null, E_SYSTEM, "A system error has been occurred. Current transaction is null.");
551
552         _TransactionNode* pParentTransaction = __pCurrentTransaction->GetParent();
553
554         if (__pCurrentTransaction->IsEmpty())
555         {
556                 if (pParentTransaction)
557                 {
558                         pParentTransaction->RemoveChild(*__pCurrentTransaction);
559                 }
560                 else
561                 {
562                         delete __pCurrentTransaction;
563                 }
564         }
565         else
566         {
567                 __pCurrentTransaction->Commit();
568
569                 if (pParentTransaction == null)
570                 {
571                         __committedList.Add(__pCurrentTransaction);
572
573                         if (__isAnimating == false)
574                         {
575                                 SetAnimatorEnabled(true);
576                         }
577                 }
578         }
579
580         __pCurrentTransaction = pParentTransaction;
581
582         if (dynamic_cast< _AnimationGroupNode* > (pParentTransaction) == null)
583         {
584                 __pCurrentTransactionExceptGroup = pParentTransaction;
585         }
586
587         return E_SUCCESS;
588 }
589
590 result
591 _AnimationManager::DiscardTransaction(void)
592 {
593         SysTryReturnResult(NID_UI_ANIM, (__pCurrentTransaction != null && __pCurrentTransaction->IsCommitted() == false), E_INVALID_OPERATION, "Transaction isn't opened.");
594
595         delete __pCurrentTransaction;
596
597         __pCurrentTransaction = null;
598         __pCurrentTransactionExceptGroup = null;
599
600         return E_SUCCESS;
601 }
602
603 result
604 _AnimationManager::DiscardTransaction(int transactionId)
605 {
606         SysTryReturnResult(NID_UI_ANIM, (__pCurrentTransaction != null), E_INVALID_OPERATION, "Transaction isn't opened.");
607
608         if (__pCurrentTransaction->GetId() == transactionId)
609         {
610                 _TransactionNode* pParentTransaction = __pCurrentTransaction->GetParent();
611
612                 if (pParentTransaction)
613                 {
614                         pParentTransaction->RemoveChild(*__pCurrentTransaction);
615                 }
616                 else
617                 {
618                         delete __pCurrentTransaction;
619                 }
620
621                 __pCurrentTransaction = pParentTransaction;
622
623                 if (dynamic_cast< _AnimationGroupNode* > (pParentTransaction) == null)
624                 {
625                         __pCurrentTransactionExceptGroup = pParentTransaction;
626                 }
627         }
628         else
629         {
630                 __pCurrentTransaction->RemoveChild(transactionId);
631         }
632
633         return E_SUCCESS;
634 }
635
636 result
637 _AnimationManager::StopTransaction(int transactionId)
638 {
639         _TransactionNode* pChild = null;
640
641         if (__committedList.IsEmpty() == false)
642         {
643                 int committedCount = __committedList.GetCount();
644
645                 _TransactionNode* pNode = null;
646
647                 for (int index = 0; index < committedCount; index++)
648                 {
649                         pNode = __committedList.GetNodeAt(index);
650
651                         if (pNode)
652                         {
653                                 if (pNode->GetId() == transactionId)
654                                 {
655                                         pNode->RemoveAll();
656
657                                         if (__isInAnimationTick == false)
658                                         {
659                                                 __committedList.RemoveAt(index);
660
661                                                 delete pNode;
662                                         }
663
664                                         return E_SUCCESS;
665                                 }
666
667                                 pChild = pNode->GetChild(transactionId);
668
669                                 if (pChild != null)
670                                 {
671                                         pNode->RemoveChild(transactionId);
672
673                                         return E_SUCCESS;
674                                 }
675                         }
676                 }
677         }
678
679         pChild = __pRootTransaction->GetChild(transactionId);
680
681         if (pChild != null)
682         {
683                 __pRootTransaction->RemoveChild(transactionId);
684
685                 return E_SUCCESS;
686         }
687
688         return E_INVALID_ARG;
689 }
690
691 bool
692 _AnimationManager::IsTransactionRunning(int transactionId) const
693 {
694         _TransactionNode* pChild = __pRootTransaction->GetChild(transactionId);
695
696         if (pChild != null)
697         {
698                 return pChild->IsRunning();
699         }
700
701         return false;
702 }
703
704 bool
705 _AnimationManager::IsImplicitAnimationEnabled(void) const
706 {
707         if (__pCurrentTransactionExceptGroup)
708         {
709                 return __pCurrentTransactionExceptGroup->IsImplicitAnimationEnabled();
710         }
711
712         return true;
713 }
714
715 _TransactionNode*
716 _AnimationManager::GetCurrentTransaction(bool withGroup) const
717 {
718         // default transaction is always committed.
719         if (__pCurrentTransaction && __pCurrentTransaction->IsCommitted())
720         {
721                 return null;
722         }
723
724         if (withGroup == false)
725         {
726                 return __pCurrentTransactionExceptGroup;
727         }
728
729         return __pCurrentTransaction;
730 }
731
732 bool
733 _AnimationManager::CreateCurrentTransactionIfNeeded(void)
734 {
735         if (__pCurrentTransaction != null)
736         {
737                 return true;
738         }
739
740         int transactionId = BeginTransaction();
741         SysTryReturn(NID_UI_ANIM, (transactionId >= 0), false, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. Failed to create _TransactionNode.");
742
743         __pCurrentTransaction->SetDefaultEventListener(null);
744
745         __pCurrentTransaction->Commit();        // default transaction is always committed.
746
747         return true;
748 }
749
750 void
751 _AnimationManager::CommitCurrentTransactionIfNeeded()
752 {
753         // if current transaction is default transaction, only status of default transaction is committed, so must process to commit transaction.
754         if (__pCurrentTransaction != null && __pCurrentTransaction->IsCommitted(true))
755         {
756                 CommitTransaction();
757         }
758 }
759
760 void
761 _AnimationManager::SetTransactionEventListener(const IAnimationTransactionEventListener* pListener)
762 {
763         static_cast< _TransactionEventListener* >(__pDefaultTransactionEventListener)->SetTransactionEventListener(pListener);
764 }
765
766 void
767 _AnimationManager::ProcessCommittedTransaction(void)
768 {
769         if (__committedList.IsEmpty())
770         {
771                 return;
772         }
773
774         int committedCount = __committedList.GetCount();
775
776         _TransactionNode* pNode = null;
777
778
779         for(int index = 0; index < committedCount; index++)
780         {
781                 pNode = __committedList.GetNodeAt(index);
782
783                 if (pNode)
784                 {
785                         pNode->DrawTargets();
786                         pNode->SetChildrenBaseTime(_AnimationTime::GetTime());
787
788                         __pRootTransaction->AddChild(*pNode);
789
790                         __committedList.SetAt(null, index);
791                 }
792         }
793
794         __committedList.RemoveAll();
795 }
796
797 void
798 _AnimationManager::ProcessAnimationTick(void)
799 {
800         if (unlikely(__isInAnimationTick))
801         {
802                 return;
803         }
804
805         __isInAnimationTick = true;
806
807         CommitCurrentTransactionIfNeeded();
808         ProcessCommittedTransaction();
809
810         // process transactions;
811         __pRootTransaction->ProcessAnimationTick(_AnimationTime::GetTime());
812
813         if (likely(__pRootTransaction->IsEmpty() && __committedList.IsEmpty()))
814         {
815                 SetAnimatorEnabled(false);
816         }
817
818         __isInAnimationTick = false;
819 }
820
821
822 }}}   // Tizen::Ui::Animations
823