OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MainThreadWorkletGlobalScope_h | 5 #ifndef ThreadedWorkletGlobalScope_h |
6 #define MainThreadWorkletGlobalScope_h | 6 #define ThreadedWorkletGlobalScope_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/ExecutionContext.h" | |
10 #include "core/frame/DOMWindowProperty.h" | |
11 #include "core/workers/WorkletGlobalScope.h" | 9 #include "core/workers/WorkletGlobalScope.h" |
12 #include "core/workers/WorkletGlobalScopeProxy.h" | |
13 | 10 |
14 namespace blink { | 11 namespace blink { |
15 | 12 |
16 class ConsoleMessage; | 13 class ConsoleMessageStorage; |
17 class LocalFrame; | 14 class WorkerInspectorController; |
18 class ScriptSourceCode; | 15 class WorkerThread; |
19 | 16 |
20 class CORE_EXPORT MainThreadWorkletGlobalScope : public WorkletGlobalScope, publ
ic WorkletGlobalScopeProxy, public DOMWindowProperty { | 17 class CORE_EXPORT ThreadedWorkletGlobalScope : public WorkletGlobalScope { |
21 public: | 18 public: |
22 ~MainThreadWorkletGlobalScope() override; | 19 ~ThreadedWorkletGlobalScope() override; |
23 bool isMainThreadWorkletGlobalScope() const final { return true; } | 20 void dispose() final; |
24 | 21 |
25 // WorkletGlobalScopeProxy | 22 // ExecutionContext |
26 void evaluateScript(const ScriptSourceCode&) final; | 23 bool isThreadedWorkletGlobalScope() const final { return true; } |
27 void terminateWorkletGlobalScope() final; | 24 bool isContextThread() const final; |
28 | 25 void postTask(const WebTraceLocation&, std::unique_ptr<ExecutionContextTask>
, const String& taskNameForInstrumentation) final; |
29 void addConsoleMessage(ConsoleMessage*) final; | 26 void addConsoleMessage(ConsoleMessage*) final; |
30 void exceptionThrown(ErrorEvent*) final; | 27 void exceptionThrown(ErrorEvent*) final; |
31 | 28 |
32 DEFINE_INLINE_VIRTUAL_TRACE() | 29 WorkerThread* thread() const { return m_thread; } |
33 { | |
34 WorkletGlobalScope::trace(visitor); | |
35 DOMWindowProperty::trace(visitor); | |
36 } | |
37 | 30 |
38 protected: | 31 protected: |
39 MainThreadWorkletGlobalScope(LocalFrame*, const KURL&, const String& userAge
nt, PassRefPtr<SecurityOrigin>, v8::Isolate*); | 32 ThreadedWorkletGlobalScope(const KURL&, const String& userAgent, PassRefPtr<
SecurityOrigin>, v8::Isolate*, WorkerThread*); |
| 33 |
| 34 private: |
| 35 WorkerThread* m_thread; |
40 }; | 36 }; |
41 | 37 |
42 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, ExecutionContext, context, conte
xt->isMainThreadWorkletGlobalScope(), context.isMainThreadWorkletGlobalScope()); | 38 DEFINE_TYPE_CASTS(ThreadedWorkletGlobalScope, ExecutionContext, context, context
->isThreadedWorkletGlobalScope(), context.isThreadedWorkletGlobalScope()); |
43 | 39 |
44 } // namespace blink | 40 } // namespace blink |
45 | 41 |
46 #endif // MainThreadWorkletGlobalScope_h | 42 #endif // ThreadedWorkletGlobalScope_h |
OLD | NEW |