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

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

Issue 2845533002: Worklet: Move Worklet::Initialize() into ThreadedWorklet for cleanup (Closed)
Patch Set: fix test failures Created 3 years, 8 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"
(...skipping 11 matching lines...) Expand all
22 // worklets. This and MainThreadWorklet will be merged into the base Worklet 22 // worklets. This and MainThreadWorklet will be merged into the base Worklet
23 // class once threaded worklets are also ready to use module loading. 23 // class once threaded worklets are also ready to use module loading.
24 class CORE_EXPORT ThreadedWorklet : public Worklet, 24 class CORE_EXPORT ThreadedWorklet : public Worklet,
25 public WorkletScriptLoader::Client { 25 public WorkletScriptLoader::Client {
26 USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet); 26 USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet);
27 WTF_MAKE_NONCOPYABLE(ThreadedWorklet); 27 WTF_MAKE_NONCOPYABLE(ThreadedWorklet);
28 28
29 public: 29 public:
30 virtual ~ThreadedWorklet() = default; 30 virtual ~ThreadedWorklet() = default;
31 31
32 // Called when addModule() is called for the first time.
33 virtual void Initialize() = 0;
kouhei (in TOK) 2017/04/26 10:47:37 Can we rename Initialize method to more descriptiv
nhiroki 2017/04/26 11:01:46 SG. Let me rename this in a separate CL because it
34 virtual bool IsInitialized() const = 0;
35
32 // Worklet 36 // Worklet
33 ScriptPromise addModule(ScriptState*, const String& url) final; 37 ScriptPromise addModule(ScriptState*, const String& url) final;
34 38
35 // WorkletScriptLoader::Client 39 // WorkletScriptLoader::Client
36 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, 40 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*,
37 const ScriptSourceCode&) final; 41 const ScriptSourceCode&) final;
38 42
39 // ContextLifecycleObserver 43 // ContextLifecycleObserver
40 void ContextDestroyed(ExecutionContext*) final; 44 void ContextDestroyed(ExecutionContext*) final;
41 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