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

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

Issue 2845533002: Worklet: Move Worklet::Initialize() into ThreadedWorklet for cleanup (Closed)
Patch Set: fix test failures 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 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 Worklet_h 5 #ifndef Worklet_h
6 #define Worklet_h 6 #define Worklet_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
(...skipping 12 matching lines...) Expand all
23 class CORE_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, 23 class CORE_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>,
24 public ScriptWrappable, 24 public ScriptWrappable,
25 public ContextLifecycleObserver { 25 public ContextLifecycleObserver {
26 DEFINE_WRAPPERTYPEINFO(); 26 DEFINE_WRAPPERTYPEINFO();
27 USING_GARBAGE_COLLECTED_MIXIN(Worklet); 27 USING_GARBAGE_COLLECTED_MIXIN(Worklet);
28 WTF_MAKE_NONCOPYABLE(Worklet); 28 WTF_MAKE_NONCOPYABLE(Worklet);
29 29
30 public: 30 public:
31 virtual ~Worklet() = default; 31 virtual ~Worklet() = default;
32 32
33 virtual void Initialize() {}
34 virtual bool IsInitialized() const { return true; }
35
36 // Worklet.idl 33 // Worklet.idl
37 // addModule() imports ES6 module scripts. 34 // addModule() imports ES6 module scripts.
38 virtual ScriptPromise addModule(ScriptState*, const String& url) = 0; 35 virtual ScriptPromise addModule(ScriptState*, const String& url) = 0;
39 36
40 // Returns a proxy to WorkletGlobalScope on the context thread. 37 // Returns a proxy to WorkletGlobalScope on the context thread.
41 virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0; 38 virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0;
42 39
43 // ContextLifecycleObserver 40 // ContextLifecycleObserver
44 virtual void ContextDestroyed(ExecutionContext*); 41 virtual void ContextDestroyed(ExecutionContext*);
45 42
46 DECLARE_VIRTUAL_TRACE(); 43 DECLARE_VIRTUAL_TRACE();
47 44
48 protected: 45 protected:
49 // The Worklet inherits the url and userAgent from the frame->document(). 46 // The Worklet inherits the url and userAgent from the frame->document().
50 explicit Worklet(LocalFrame*); 47 explicit Worklet(LocalFrame*);
51 48
52 Member<LocalFrame> frame_; 49 Member<LocalFrame> frame_;
53 }; 50 };
54 51
55 } // namespace blink 52 } // namespace blink
56 53
57 #endif // Worklet_h 54 #endif // Worklet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698