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