1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CompositorWorkerGlobalScope_h
6 #define CompositorWorkerGlobalScope_h
8 #include "core/dom/FrameRequestCallbackCollection.h"
9 #include "core/dom/MessagePort.h"
10 #include "core/workers/WorkerGlobalScope.h"
14 class CompositorWorkerThread
;
15 class WorkerThreadStartupData
;
17 class CompositorWorkerGlobalScope final
: public WorkerGlobalScope
{
18 DEFINE_WRAPPERTYPEINFO();
20 static PassRefPtrWillBeRawPtr
<CompositorWorkerGlobalScope
> create(CompositorWorkerThread
*, PassOwnPtr
<WorkerThreadStartupData
>, double timeOrigin
);
21 ~CompositorWorkerGlobalScope() override
;
24 const AtomicString
& interfaceName() const override
;
26 void postMessage(ExecutionContext
*, PassRefPtr
<SerializedScriptValue
>, const MessagePortArray
*, ExceptionState
&);
27 DEFINE_ATTRIBUTE_EVENT_LISTENER(message
);
29 int requestAnimationFrame(FrameRequestCallback
*);
30 void cancelAnimationFrame(int id
);
31 void executeAnimationFrameCallbacks(double highResTimeNow
);
34 bool isCompositorWorkerGlobalScope() const override
{ return true; }
36 DECLARE_VIRTUAL_TRACE();
39 CompositorWorkerGlobalScope(const KURL
&, const String
& userAgent
, CompositorWorkerThread
*, double timeOrigin
, PassOwnPtr
<SecurityOrigin::PrivilegeData
>, PassOwnPtrWillBeRawPtr
<WorkerClients
>);
40 CompositorWorkerThread
* thread() const;
42 FrameRequestCallbackCollection m_callbackCollection
;
47 #endif // CompositorWorkerGlobalScope_h