Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Side by Side Diff: Source/core/dom/ScriptedAnimationController.h

Issue 92913002: Manage RequestAnimationFrameCallbacks with OwnPtrs instead of RefPtrs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public: 43 public:
44 static PassRefPtr<ScriptedAnimationController> create(Document* document) 44 static PassRefPtr<ScriptedAnimationController> create(Document* document)
45 { 45 {
46 return adoptRef(new ScriptedAnimationController(document)); 46 return adoptRef(new ScriptedAnimationController(document));
47 } 47 }
48 ~ScriptedAnimationController(); 48 ~ScriptedAnimationController();
49 void clearDocumentPointer() { m_document = 0; } 49 void clearDocumentPointer() { m_document = 0; }
50 50
51 typedef int CallbackId; 51 typedef int CallbackId;
52 52
53 int registerCallback(PassRefPtr<RequestAnimationFrameCallback>); 53 int registerCallback(PassOwnPtr<RequestAnimationFrameCallback>);
54 void cancelCallback(CallbackId); 54 void cancelCallback(CallbackId);
55 void serviceScriptedAnimations(double monotonicTimeNow); 55 void serviceScriptedAnimations(double monotonicTimeNow);
56 56
57 void enqueueEvent(PassRefPtr<Event>); 57 void enqueueEvent(PassRefPtr<Event>);
58 void enqueuePerFrameEvent(PassRefPtr<Event>); 58 void enqueuePerFrameEvent(PassRefPtr<Event>);
59 59
60 void suspend(); 60 void suspend();
61 void resume(); 61 void resume();
62 62
63 private: 63 private:
64 explicit ScriptedAnimationController(Document*); 64 explicit ScriptedAnimationController(Document*);
65 65
66 void scheduleAnimationIfNeeded(); 66 void scheduleAnimationIfNeeded();
67 67
68 void dispatchEvents(); 68 void dispatchEvents();
69 void executeCallbacks(double monotonicTimeNow); 69 void executeCallbacks(double monotonicTimeNow);
70 70
71 typedef Vector<RefPtr<RequestAnimationFrameCallback> > CallbackList; 71 typedef Vector<OwnPtr<RequestAnimationFrameCallback> > CallbackList;
72 CallbackList m_callbacks; 72 CallbackList m_callbacks;
73 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall backs
73 74
74 Document* m_document; 75 Document* m_document;
75 CallbackId m_nextCallbackId; 76 CallbackId m_nextCallbackId;
76 int m_suspendCount; 77 int m_suspendCount;
77 Vector<RefPtr<Event> > m_eventQueue; 78 Vector<RefPtr<Event> > m_eventQueue;
78 ListHashSet<std::pair<const EventTarget*, const StringImpl*> > m_perFrameEve nts; 79 ListHashSet<std::pair<const EventTarget*, const StringImpl*> > m_perFrameEve nts;
79 }; 80 };
80 81
81 } 82 }
82 83
83 #endif // ScriptedAnimationController_h 84 #endif // ScriptedAnimationController_h
OLDNEW
« no previous file with comments | « Source/core/dom/RequestAnimationFrameCallback.h ('k') | Source/core/dom/ScriptedAnimationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698