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 MainThreadWorkletGlobalScope_h |
6 #define MainThreadWorkletGlobalScope_h | 6 #define MainThreadWorkletGlobalScope_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/dom/ExecutionContext.h" | 9 #include "core/dom/ExecutionContext.h" |
10 #include "core/frame/LocalFrameLifecycleObserver.h" | 10 #include "core/frame/LocalFrameLifecycleObserver.h" |
11 #include "core/workers/WorkletGlobalScope.h" | 11 #include "core/workers/WorkletGlobalScope.h" |
12 #include "core/workers/WorkletGlobalScopeProxy.h" | 12 #include "core/workers/WorkletGlobalScopeProxy.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class ConsoleMessage; | 16 class ConsoleMessage; |
17 class LocalFrame; | 17 class LocalFrame; |
| 18 class ScriptSourceCode; |
18 | 19 |
19 class CORE_EXPORT MainThreadWorkletGlobalScope : public WorkletGlobalScope, publ
ic WorkletGlobalScopeProxy, public LocalFrameLifecycleObserver { | 20 class CORE_EXPORT MainThreadWorkletGlobalScope : public WorkletGlobalScope, publ
ic WorkletGlobalScopeProxy, public LocalFrameLifecycleObserver { |
20 public: | 21 public: |
21 ~MainThreadWorkletGlobalScope() override; | 22 ~MainThreadWorkletGlobalScope() override; |
22 bool isMainThreadWorkletGlobalScope() const final { return true; } | 23 bool isMainThreadWorkletGlobalScope() const final { return true; } |
23 | 24 |
24 // WorkletGlobalScopeProxy | 25 // WorkletGlobalScopeProxy |
25 void evaluateScript(const String& source, const KURL& scriptURL) final; | 26 void evaluateScript(const ScriptSourceCode&) final; |
26 void terminateWorkletGlobalScope() final; | 27 void terminateWorkletGlobalScope() final; |
27 | 28 |
28 // WorkerOrWorkletGlobalScope | 29 // WorkerOrWorkletGlobalScope |
29 bool isClosing() const final { return false; } | 30 bool isClosing() const final { return false; } |
30 | 31 |
31 using LocalFrameLifecycleObserver::frame; | 32 using LocalFrameLifecycleObserver::frame; |
32 void addConsoleMessage(ConsoleMessage*) final; | 33 void addConsoleMessage(ConsoleMessage*) final; |
33 void exceptionThrown(const String& errorMessage, std::unique_ptr<SourceLocat
ion>) final; | 34 void exceptionThrown(const String& errorMessage, std::unique_ptr<SourceLocat
ion>) final; |
34 | 35 |
35 DEFINE_INLINE_VIRTUAL_TRACE() | 36 DEFINE_INLINE_VIRTUAL_TRACE() |
36 { | 37 { |
37 WorkletGlobalScope::trace(visitor); | 38 WorkletGlobalScope::trace(visitor); |
38 LocalFrameLifecycleObserver::trace(visitor); | 39 LocalFrameLifecycleObserver::trace(visitor); |
39 } | 40 } |
40 | 41 |
41 protected: | 42 protected: |
42 MainThreadWorkletGlobalScope(LocalFrame*, const KURL&, const String& userAge
nt, PassRefPtr<SecurityOrigin>, v8::Isolate*); | 43 MainThreadWorkletGlobalScope(LocalFrame*, const KURL&, const String& userAge
nt, PassRefPtr<SecurityOrigin>, v8::Isolate*); |
43 }; | 44 }; |
44 | 45 |
45 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, ExecutionContext, context, conte
xt->isMainThreadWorkletGlobalScope(), context.isMainThreadWorkletGlobalScope()); | 46 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, ExecutionContext, context, conte
xt->isMainThreadWorkletGlobalScope(), context.isMainThreadWorkletGlobalScope()); |
46 | 47 |
47 } // namespace blink | 48 } // namespace blink |
48 | 49 |
49 #endif // MainThreadWorkletGlobalScope_h | 50 #endif // MainThreadWorkletGlobalScope_h |
OLD | NEW |