Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "wtf/Vector.h" | 33 #include "wtf/Vector.h" |
| 34 #include "wtf/text/StringImpl.h" | 34 #include "wtf/text/StringImpl.h" |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 | 37 |
| 38 class Document; | 38 class Document; |
| 39 class Event; | 39 class Event; |
| 40 class EventTarget; | 40 class EventTarget; |
| 41 class RequestAnimationFrameCallback; | 41 class RequestAnimationFrameCallback; |
| 42 | 42 |
| 43 class ScriptedAnimationController : public RefCounted<ScriptedAnimationControlle r> { | 43 class ScriptedAnimationController : public RefCountedWillBeGarbageCollectedFinal ized<ScriptedAnimationController> { |
|
haraken
2014/06/17 06:44:48
Can this be RefCountedWillBeGarbageCollected?
tkent
2014/06/17 06:50:32
No. CallbackList needs finalization.
| |
| 44 public: | 44 public: |
| 45 static PassRefPtr<ScriptedAnimationController> create(Document* document) | 45 static PassRefPtrWillBeRawPtr<ScriptedAnimationController> create(Document* document) |
| 46 { | 46 { |
| 47 return adoptRef(new ScriptedAnimationController(document)); | 47 return adoptRefWillBeNoop(new ScriptedAnimationController(document)); |
| 48 } | 48 } |
| 49 ~ScriptedAnimationController(); | 49 ~ScriptedAnimationController(); |
|
haraken
2014/06/17 06:44:48
Then you'll need to use DEFINE_EMPTY_DESTRUCTOR_WI
| |
| 50 void clearDocumentPointer() { m_document = 0; } | 50 void trace(Visitor*); |
| 51 void clearDocumentPointer() { m_document = nullptr; } | |
| 51 | 52 |
| 52 typedef int CallbackId; | 53 typedef int CallbackId; |
| 53 | 54 |
| 54 int registerCallback(PassOwnPtr<RequestAnimationFrameCallback>); | 55 int registerCallback(PassOwnPtr<RequestAnimationFrameCallback>); |
| 55 void cancelCallback(CallbackId); | 56 void cancelCallback(CallbackId); |
| 56 void serviceScriptedAnimations(double monotonicTimeNow); | 57 void serviceScriptedAnimations(double monotonicTimeNow); |
| 57 | 58 |
| 58 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 59 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
| 59 void enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Event>); | 60 void enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Event>); |
| 60 | 61 |
| 61 void suspend(); | 62 void suspend(); |
| 62 void resume(); | 63 void resume(); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 explicit ScriptedAnimationController(Document*); | 66 explicit ScriptedAnimationController(Document*); |
| 66 | 67 |
| 67 void scheduleAnimationIfNeeded(); | 68 void scheduleAnimationIfNeeded(); |
| 68 | 69 |
| 69 void dispatchEvents(); | 70 void dispatchEvents(); |
| 70 void executeCallbacks(double monotonicTimeNow); | 71 void executeCallbacks(double monotonicTimeNow); |
| 71 | 72 |
| 72 typedef Vector<OwnPtr<RequestAnimationFrameCallback> > CallbackList; | 73 typedef Vector<OwnPtr<RequestAnimationFrameCallback> > CallbackList; |
| 73 CallbackList m_callbacks; | 74 CallbackList m_callbacks; |
| 74 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall backs | 75 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall backs |
| 75 | 76 |
| 76 Document* m_document; | 77 RawPtrWillBeMember<Document> m_document; |
| 77 CallbackId m_nextCallbackId; | 78 CallbackId m_nextCallbackId; |
| 78 int m_suspendCount; | 79 int m_suspendCount; |
| 79 WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_eventQueue; | 80 WillBeHeapVector<RefPtrWillBeMember<Event> > m_eventQueue; |
| 80 ListHashSet<std::pair<const EventTarget*, const StringImpl*> > m_perFrameEve nts; | 81 WillBeHeapListHashSet<std::pair<RawPtrWillBeMember<const EventTarget>, const StringImpl*> > m_perFrameEvents; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 } | 84 } |
| 84 | 85 |
| 85 #endif // ScriptedAnimationController_h | 86 #endif // ScriptedAnimationController_h |
| OLD | NEW |