Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: third_party/WebKit/Source/core/workers/ThreadedWorklet.h

Issue 2840523002: [DONT COMMIT] Worklet: Implement "addModule()" algorithm for main thread worklets (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 ThreadedWorklet_h 5 #ifndef ThreadedWorklet_h
6 #define ThreadedWorklet_h 6 #define ThreadedWorklet_h
7 7
8 #include "core/workers/Worklet.h" 8 #include "core/workers/Worklet.h"
9 9
10 #include "bindings/core/v8/ScriptPromiseResolver.h" 10 #include "bindings/core/v8/ScriptPromiseResolver.h"
11 #include "core/CoreExport.h" 11 #include "core/CoreExport.h"
12 #include "core/loader/WorkletScriptLoader.h" 12 #include "core/loader/WorkletScriptLoader.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class LocalFrame; 17 class LocalFrame;
18 class WorkletGlobalScopeProxy;
18 19
19 // A ThreadedWorklet is a worklet that runs off the main thread. 20 // A ThreadedWorklet is a worklet that runs off the main thread.
20 // TODO(nhiroki): This is a temporary class to keep classic script loading for 21 // TODO(nhiroki): This is a temporary class to keep classic script loading for
21 // threaded worklets while module loading is being implemented for main thread 22 // threaded worklets while module loading is being implemented for main thread
22 // worklets. This and MainThreadWorklet will be merged into the base Worklet 23 // worklets. This and MainThreadWorklet will be merged into the base Worklet
23 // class once threaded worklets are also ready to use module loading. 24 // class once threaded worklets are also ready to use module loading.
24 class CORE_EXPORT ThreadedWorklet : public Worklet, 25 class CORE_EXPORT ThreadedWorklet : public Worklet,
25 public WorkletScriptLoader::Client { 26 public WorkletScriptLoader::Client {
26 USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet); 27 USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet);
27 WTF_MAKE_NONCOPYABLE(ThreadedWorklet); 28 WTF_MAKE_NONCOPYABLE(ThreadedWorklet);
28 29
29 public: 30 public:
30 virtual ~ThreadedWorklet() = default; 31 virtual ~ThreadedWorklet() = default;
31 32
32 // Worklet 33 // Worklet
33 ScriptPromise addModule(ScriptState*, const String& url) final; 34 ScriptPromise addModule(ScriptState*, const String& url) final;
34 35
35 // WorkletScriptLoader::Client 36 // WorkletScriptLoader::Client
36 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, 37 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*,
37 const ScriptSourceCode&) final; 38 const ScriptSourceCode&) final;
38 39
39 // ContextLifecycleObserver 40 // ContextLifecycleObserver
40 void ContextDestroyed(ExecutionContext*) final; 41 void ContextDestroyed(ExecutionContext*) final;
41 42
43 // Returns a proxy to WorkletGlobalScope on the context thread.
44 virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0;
45
42 DECLARE_VIRTUAL_TRACE(); 46 DECLARE_VIRTUAL_TRACE();
43 47
44 protected: 48 protected:
45 explicit ThreadedWorklet(LocalFrame*); 49 explicit ThreadedWorklet(LocalFrame*);
46 50
47 private: 51 private:
48 HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>> 52 HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>>
49 loader_to_resolver_map_; 53 loader_to_resolver_map_;
50 }; 54 };
51 55
52 } // namespace blink 56 } // namespace blink
53 57
54 #endif // ThreadedWorklet_h 58 #endif // ThreadedWorklet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698