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

Side by Side Diff: third_party/WebKit/Source/modules/worklet/WorkletScriptLoader.h

Issue 2178223002: Refactor Worklet class to use ScriptResource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: synced to the head Created 4 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WorkletScriptLoader_h
6 #define WorkletScriptLoader_h
7
8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/fetch/ResourceClient.h"
10 #include "core/fetch/ResourceOwner.h"
11 #include "core/fetch/ScriptResource.h"
12
13 namespace blink {
14
15 class Worklet;
16
17 // Class that is responsible for processing {@code resource} that is associated with worklet's import promise.
18 class WorkletScriptLoader final : public GarbageCollectedFinalized<WorkletScript Loader>, public ResourceOwner<ScriptResource, ScriptResourceClient> {
19 USING_GARBAGE_COLLECTED_MIXIN(WorkletScriptLoader);
20 WTF_MAKE_NONCOPYABLE(WorkletScriptLoader);
21 public:
22 static WorkletScriptLoader* create(ScriptPromiseResolver* scriptPromiseResol ver, Worklet* worklet, ScriptResource* resource)
23 {
24 return new WorkletScriptLoader(scriptPromiseResolver, worklet, resource) ;
25 }
26
27 ~WorkletScriptLoader() override = default;
28
29 // Cancels loading of {@code m_resource}.
30 //
31 // Typically it gets called when WorkletScriptLoader's host is about to be d isposed off.
32 void cancel();
33
34 DECLARE_TRACE();
35
36 private:
37 // Default constructor.
38 //
39 // @param resolver Promise resolver that is used to reject/resolve the promi se on ScriptResourceClient::notifyFinished event.
40 // @param host Host that needs be notified when the resource is downloaded.
41 // @param resource that needs to be downloaded.
42 WorkletScriptLoader(ScriptPromiseResolver*, Worklet* host, ScriptResource*);
43
44 // ResourceClient
45 void notifyFinished(Resource*) final;
46 String debugName() const final { return "WorkletLoader"; }
47
48 Member<ScriptPromiseResolver> m_resolver;
49 Member<Worklet> m_host;
50 };
51
52 } // namespace blink
53
54 #endif // WorkletScriptLoader_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698