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

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

Issue 8899006: Merge 102405 - Source/WebCore: Improve handling of frame removal during requestAnimationFrame cal... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 9 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
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/dom/ScriptedAnimationController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 28
29 #if ENABLE(REQUEST_ANIMATION_FRAME) 29 #if ENABLE(REQUEST_ANIMATION_FRAME)
30 #include "DOMTimeStamp.h" 30 #include "DOMTimeStamp.h"
31 #if USE(REQUEST_ANIMATION_FRAME_TIMER) 31 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
32 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 32 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
33 #include "DisplayRefreshMonitor.h" 33 #include "DisplayRefreshMonitor.h"
34 #endif 34 #endif
35 #include "Timer.h" 35 #include "Timer.h"
36 #endif 36 #endif
37 #include "PlatformScreen.h" 37 #include "PlatformScreen.h"
38 #include <wtf/Noncopyable.h> 38 #include <wtf/RefCounted.h>
39 #include <wtf/PassOwnPtr.h>
40 #include <wtf/RefPtr.h> 39 #include <wtf/RefPtr.h>
41 #include <wtf/Vector.h> 40 #include <wtf/Vector.h>
42 41
43 namespace WebCore { 42 namespace WebCore {
44 43
45 class Document; 44 class Document;
46 class Element; 45 class Element;
47 class RequestAnimationFrameCallback; 46 class RequestAnimationFrameCallback;
48 47
49 class ScriptedAnimationController 48 class ScriptedAnimationController : public RefCounted<ScriptedAnimationControlle r>
50 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) 49 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
51 : public DisplayRefreshMonitorClient 50 , public DisplayRefreshMonitorClient
52 #endif 51 #endif
53 { 52 {
54 WTF_MAKE_NONCOPYABLE(ScriptedAnimationController);
55 public: 53 public:
56 static PassOwnPtr<ScriptedAnimationController> create(Document* document, Pl atformDisplayID displayID) 54 static PassRefPtr<ScriptedAnimationController> create(Document* document, Pl atformDisplayID displayID)
57 { 55 {
58 return adoptPtr(new ScriptedAnimationController(document, displayID)); 56 return adoptRef(new ScriptedAnimationController(document, displayID));
59 } 57 }
58 ~ScriptedAnimationController();
59 void clearDocumentPointer() { m_document = 0; }
60 60
61 typedef int CallbackId; 61 typedef int CallbackId;
62 62
63 CallbackId registerCallback(PassRefPtr<RequestAnimationFrameCallback>, Eleme nt*); 63 CallbackId registerCallback(PassRefPtr<RequestAnimationFrameCallback>, Eleme nt*);
64 void cancelCallback(CallbackId); 64 void cancelCallback(CallbackId);
65 void serviceScriptedAnimations(DOMTimeStamp); 65 void serviceScriptedAnimations(DOMTimeStamp);
66 66
67 void suspend(); 67 void suspend();
68 void resume(); 68 void resume();
69 69
70 void windowScreenDidChange(PlatformDisplayID); 70 void windowScreenDidChange(PlatformDisplayID);
71 71
72 private: 72 private:
73 explicit ScriptedAnimationController(Document*, PlatformDisplayID); 73 ScriptedAnimationController(Document*, PlatformDisplayID);
74 74
75 typedef Vector<RefPtr<RequestAnimationFrameCallback> > CallbackList; 75 typedef Vector<RefPtr<RequestAnimationFrameCallback> > CallbackList;
76 CallbackList m_callbacks; 76 CallbackList m_callbacks;
77 77
78 Document* m_document; 78 Document* m_document;
79 CallbackId m_nextCallbackId; 79 CallbackId m_nextCallbackId;
80 int m_suspendCount; 80 int m_suspendCount;
81 81
82 void scheduleAnimation(); 82 void scheduleAnimation();
83 83
(...skipping 10 matching lines...) Expand all
94 #endif 94 #endif
95 #endif 95 #endif
96 }; 96 };
97 97
98 } 98 }
99 99
100 #endif // ENABLE(REQUEST_ANIMATION_FRAME) 100 #endif // ENABLE(REQUEST_ANIMATION_FRAME)
101 101
102 #endif // ScriptedAnimationController_h 102 #endif // ScriptedAnimationController_h
103 103
OLDNEW
« no previous file with comments | « Source/WebCore/dom/Document.cpp ('k') | Source/WebCore/dom/ScriptedAnimationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698