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

Side by Side Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 491053004: Expose Web Animations API to Web Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 17 matching lines...) Expand all
28 #include "config.h" 28 #include "config.h"
29 #include "core/workers/WorkerGlobalScope.h" 29 #include "core/workers/WorkerGlobalScope.h"
30 30
31 #include "bindings/core/v8/ExceptionState.h" 31 #include "bindings/core/v8/ExceptionState.h"
32 #include "bindings/core/v8/ScheduledAction.h" 32 #include "bindings/core/v8/ScheduledAction.h"
33 #include "bindings/core/v8/ScriptSourceCode.h" 33 #include "bindings/core/v8/ScriptSourceCode.h"
34 #include "bindings/core/v8/ScriptValue.h" 34 #include "bindings/core/v8/ScriptValue.h"
35 #include "core/dom/ActiveDOMObject.h" 35 #include "core/dom/ActiveDOMObject.h"
36 #include "core/dom/AddConsoleMessageTask.h" 36 #include "core/dom/AddConsoleMessageTask.h"
37 #include "core/dom/ContextLifecycleNotifier.h" 37 #include "core/dom/ContextLifecycleNotifier.h"
38 #include "core/dom/CrossThreadTask.h"
38 #include "core/dom/DOMURL.h" 39 #include "core/dom/DOMURL.h"
39 #include "core/dom/ExceptionCode.h" 40 #include "core/dom/ExceptionCode.h"
40 #include "core/dom/MessagePort.h" 41 #include "core/dom/MessagePort.h"
41 #include "core/events/ErrorEvent.h" 42 #include "core/events/ErrorEvent.h"
42 #include "core/events/Event.h" 43 #include "core/events/Event.h"
43 #include "core/inspector/InspectorConsoleInstrumentation.h" 44 #include "core/inspector/InspectorConsoleInstrumentation.h"
44 #include "core/inspector/ScriptCallStack.h" 45 #include "core/inspector/ScriptCallStack.h"
45 #include "core/inspector/WorkerInspectorController.h" 46 #include "core/inspector/WorkerInspectorController.h"
46 #include "core/loader/WorkerThreadableLoader.h" 47 #include "core/loader/WorkerThreadableLoader.h"
47 #include "core/frame/LocalDOMWindow.h" 48 #include "core/frame/LocalDOMWindow.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 ScriptWrappable::init(this); 93 ScriptWrappable::init(this);
93 setClient(this); 94 setClient(this);
94 setSecurityOrigin(SecurityOrigin::create(url)); 95 setSecurityOrigin(SecurityOrigin::create(url));
95 m_workerClients->reattachThread(); 96 m_workerClients->reattachThread();
96 } 97 }
97 98
98 WorkerGlobalScope::~WorkerGlobalScope() 99 WorkerGlobalScope::~WorkerGlobalScope()
99 { 100 {
100 } 101 }
101 102
103 void WorkerGlobalScope::requestAnimationFrame(PassOwnPtr<RequestAnimationFrameCa llback> insert)
104 {
105 if (!rAFPendingList) {
106 rAFPendingList = adoptPtr(new Vector<OwnPtr<RequestAnimationFrameCallbac k> >());
107 }
108 rAFPendingList->append(insert);
109 }
110
111 void WorkerGlobalScope::processRAF(double monotonicAnimationStartTime)
112 {
113 postTask(createCrossThreadTask(&WorkerGlobalScope::processRAFOnWorkerThread, this, monotonicAnimationStartTime));
114 }
115
116 void WorkerGlobalScope::processRAFOnWorkerThread(double monotonicAnimationStartT ime)
117 {
118 if (!rAFPendingList)
119 return;
120 OwnPtr<Vector<OwnPtr<RequestAnimationFrameCallback> > > oldRAFList = rAFPend ingList.release();
121 for (unsigned i = 0; i < oldRAFList->size(); i++) {
122 oldRAFList->at(i)->handleEvent(monotonicAnimationStartTime);
123 }
124 }
125
102 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) 126 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic y, ContentSecurityPolicyHeaderType contentSecurityPolicyType)
103 { 127 {
104 setContentSecurityPolicy(ContentSecurityPolicy::create(this)); 128 setContentSecurityPolicy(ContentSecurityPolicy::create(this));
105 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP); 129 contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType, ContentSecurityPolicyHeaderSourceHTTP);
106 } 130 }
107 131
108 ExecutionContext* WorkerGlobalScope::executionContext() const 132 ExecutionContext* WorkerGlobalScope::executionContext() const
109 { 133 {
110 return const_cast<WorkerGlobalScope*>(this); 134 return const_cast<WorkerGlobalScope*>(this);
111 } 135 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 visitor->trace(m_location); 364 visitor->trace(m_location);
341 visitor->trace(m_navigator); 365 visitor->trace(m_navigator);
342 visitor->trace(m_eventQueue); 366 visitor->trace(m_eventQueue);
343 visitor->trace(m_workerClients); 367 visitor->trace(m_workerClients);
344 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); 368 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor);
345 ExecutionContext::trace(visitor); 369 ExecutionContext::trace(visitor);
346 EventTargetWithInlineData::trace(visitor); 370 EventTargetWithInlineData::trace(visitor);
347 } 371 }
348 372
349 } // namespace blink 373 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698