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 WorkletGlobalScopeProxy_h | 5 #ifndef WorkletGlobalScopeProxy_h |
6 #define WorkletGlobalScopeProxy_h | 6 #define WorkletGlobalScopeProxy_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/WebTaskRunner.h" | 9 #include "platform/WebTaskRunner.h" |
10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
11 #include "public/platform/WebURLRequest.h" | 11 #include "public/platform/WebURLRequest.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class ScriptSourceCode; | |
16 class WorkletPendingTasks; | 15 class WorkletPendingTasks; |
17 | 16 |
18 // Abstracts communication from (Main/Threaded)Worklet on the main thread to | 17 // Abstracts communication from (Main/Threaded)Worklet on the main thread to |
19 // (Main/Threaded)WorkletGlobalScope so that Worklet class doesn't have to care | 18 // (Main/Threaded)WorkletGlobalScope so that Worklet class doesn't have to care |
20 // about the thread WorkletGlobalScope runs on. | 19 // about the thread WorkletGlobalScope runs on. |
21 class CORE_EXPORT WorkletGlobalScopeProxy { | 20 class CORE_EXPORT WorkletGlobalScopeProxy { |
22 public: | 21 public: |
23 virtual ~WorkletGlobalScopeProxy() {} | 22 virtual ~WorkletGlobalScopeProxy() {} |
24 | 23 |
25 // Runs the "fetch and invoke a worklet script" algorithm: | 24 // Runs the "fetch and invoke a worklet script" algorithm: |
26 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script | 25 // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script |
27 virtual void FetchAndInvokeScript( | 26 virtual void FetchAndInvokeScript( |
28 const KURL& module_url_record, | 27 const KURL& module_url_record, |
29 WebURLRequest::FetchCredentialsMode, | 28 WebURLRequest::FetchCredentialsMode, |
30 RefPtr<WebTaskRunner> outside_settings_task_runner, | 29 RefPtr<WebTaskRunner> outside_settings_task_runner, |
31 WorkletPendingTasks*) {} | 30 WorkletPendingTasks*) {} |
32 | 31 |
33 // Evaluates the given script source code. This should be called only for | |
34 // threaded worklets that still use classic script loading. | |
35 virtual void EvaluateScript(const ScriptSourceCode&) = 0; | |
36 | |
37 // Terminates the worklet global scope from the main thread. | 32 // Terminates the worklet global scope from the main thread. |
38 virtual void TerminateWorkletGlobalScope() = 0; | 33 virtual void TerminateWorkletGlobalScope() = 0; |
39 }; | 34 }; |
40 | 35 |
41 } // namespace blink | 36 } // namespace blink |
42 | 37 |
43 #endif // WorkletGlobalScopeProxy_h | 38 #endif // WorkletGlobalScopeProxy_h |
OLD | NEW |