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/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
11 #include "core/workers/WorkletGlobalScope.h" | 11 #include "core/workers/WorkletGlobalScope.h" |
| 12 #include "core/workers/WorkletModuleResponsesMapProxy.h" |
12 #include "core/workers/WorkletPendingTasks.h" | 13 #include "core/workers/WorkletPendingTasks.h" |
13 #include "platform/WebTaskRunner.h" | 14 #include "platform/WebTaskRunner.h" |
14 #include "public/platform/WebURLRequest.h" | 15 #include "public/platform/WebURLRequest.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 class ConsoleMessage; | 19 class ConsoleMessage; |
19 class LocalFrame; | 20 class LocalFrame; |
| 21 class WorkletModuleResponsesMap; |
20 | 22 |
21 class CORE_EXPORT MainThreadWorkletGlobalScope | 23 class CORE_EXPORT MainThreadWorkletGlobalScope |
22 : public WorkletGlobalScope, | 24 : public WorkletGlobalScope, |
23 public ContextClient { | 25 public ContextClient { |
24 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope); | 26 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope); |
25 | 27 |
26 public: | 28 public: |
27 MainThreadWorkletGlobalScope(LocalFrame*, | 29 MainThreadWorkletGlobalScope(LocalFrame*, |
28 const KURL&, | 30 const KURL&, |
29 const String& user_agent, | 31 const String& user_agent, |
30 PassRefPtr<SecurityOrigin>, | 32 PassRefPtr<SecurityOrigin>, |
31 v8::Isolate*); | 33 v8::Isolate*); |
32 ~MainThreadWorkletGlobalScope() override; | 34 ~MainThreadWorkletGlobalScope() override; |
33 bool IsMainThreadWorkletGlobalScope() const final { return true; } | 35 bool IsMainThreadWorkletGlobalScope() const final { return true; } |
34 | 36 |
35 // WorkerOrWorkletGlobalScope | 37 // WorkerOrWorkletGlobalScope |
36 void ReportFeature(WebFeature) override; | 38 void ReportFeature(WebFeature) override; |
37 void ReportDeprecation(WebFeature) override; | 39 void ReportDeprecation(WebFeature) override; |
38 WorkerThread* GetThread() const final; | 40 WorkerThread* GetThread() const final; |
39 | 41 |
40 // Implementation of the "fetch and invoke a worklet script" algorithm: | 42 // Implementation of the "fetch and invoke a worklet script" algorithm: |
41 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script | 43 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script |
42 // When script evaluation is done or any exception happens, it's notified to | 44 // When script evaluation is done or any exception happens, it's notified to |
43 // the given WorkletPendingTasks via |outside_settings_task_runner| (i.e., the | 45 // the given WorkletPendingTasks via |outside_settings_task_runner| (i.e., the |
44 // parent frame's task runner). | 46 // parent frame's task runner). |
45 void FetchAndInvokeScript(const KURL& module_url_record, | 47 void FetchAndInvokeScript(const KURL& module_url_record, |
| 48 WorkletModuleResponsesMap*, |
46 WebURLRequest::FetchCredentialsMode, | 49 WebURLRequest::FetchCredentialsMode, |
47 RefPtr<WebTaskRunner> outside_settings_task_runner, | 50 RefPtr<WebTaskRunner> outside_settings_task_runner, |
48 WorkletPendingTasks*); | 51 WorkletPendingTasks*); |
49 | 52 |
50 void Terminate(); | 53 void Terminate(); |
51 | 54 |
| 55 WorkletModuleResponsesMapProxy* GetModuleResponsesMapProxy() const; |
| 56 |
52 // ExecutionContext | 57 // ExecutionContext |
53 void AddConsoleMessage(ConsoleMessage*) final; | 58 void AddConsoleMessage(ConsoleMessage*) final; |
54 void ExceptionThrown(ErrorEvent*) final; | 59 void ExceptionThrown(ErrorEvent*) final; |
55 CoreProbeSink* GetProbeSink() final; | 60 CoreProbeSink* GetProbeSink() final; |
56 | 61 |
57 DECLARE_VIRTUAL_TRACE(); | 62 DECLARE_VIRTUAL_TRACE(); |
| 63 |
| 64 private: |
| 65 Member<WorkletModuleResponsesMapProxy> module_responses_map_proxy_; |
58 }; | 66 }; |
59 | 67 |
60 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, | 68 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, |
61 ExecutionContext, | 69 ExecutionContext, |
62 context, | 70 context, |
63 context->IsMainThreadWorkletGlobalScope(), | 71 context->IsMainThreadWorkletGlobalScope(), |
64 context.IsMainThreadWorkletGlobalScope()); | 72 context.IsMainThreadWorkletGlobalScope()); |
65 | 73 |
66 } // namespace blink | 74 } // namespace blink |
67 | 75 |
68 #endif // MainThreadWorkletGlobalScope_h | 76 #endif // MainThreadWorkletGlobalScope_h |
OLD | NEW |