Index: Source/core/workers/WorkerGlobalScope.cpp |
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp |
index 62529dfb043ba36301adffc8ef54fa7e93ef0fda..da890afc213186bf865db94d931b72075c35e083 100644 |
--- a/Source/core/workers/WorkerGlobalScope.cpp |
+++ b/Source/core/workers/WorkerGlobalScope.cpp |
@@ -35,6 +35,7 @@ |
#include "core/dom/ActiveDOMObject.h" |
#include "core/dom/AddConsoleMessageTask.h" |
#include "core/dom/ContextLifecycleNotifier.h" |
+#include "core/dom/CrossThreadTask.h" |
#include "core/dom/DOMURL.h" |
#include "core/dom/ExceptionCode.h" |
#include "core/dom/MessagePort.h" |
@@ -99,6 +100,29 @@ WorkerGlobalScope::~WorkerGlobalScope() |
{ |
} |
+void WorkerGlobalScope::requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCallback> insert) |
+{ |
+ if (!rAFPendingList) { |
+ rAFPendingList = adoptPtr(new Vector<OwnPtr<RequestAnimationFrameCallback> >()); |
+ } |
+ rAFPendingList->append(insert); |
+} |
+ |
+void WorkerGlobalScope::processRAF(double monotonicAnimationStartTime) |
+{ |
+ postTask(createCrossThreadTask(&WorkerGlobalScope::processRAFOnWorkerThread, this, monotonicAnimationStartTime)); |
+} |
+ |
+void WorkerGlobalScope::processRAFOnWorkerThread(double monotonicAnimationStartTime) |
+{ |
+ if (!rAFPendingList) |
+ return; |
+ OwnPtr<Vector<OwnPtr<RequestAnimationFrameCallback> > > oldRAFList = rAFPendingList.release(); |
+ for (unsigned i = 0; i < oldRAFList->size(); i++) { |
+ oldRAFList->at(i)->handleEvent(monotonicAnimationStartTime); |
+ } |
+} |
+ |
void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
{ |
setContentSecurityPolicy(ContentSecurityPolicy::create(this)); |