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

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

Issue 2178223002: Refactor Worklet class to use ScriptResource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed comments & 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
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/dom/ActiveDOMObject.h" 10 #include "core/dom/ActiveDOMObject.h"
11 #include "core/frame/csp/ContentSecurityPolicy.h" 11 #include "core/fetch/ScriptResource.h"
12 #include "core/workers/WorkerScriptLoader.h"
13 #include "modules/ModulesExport.h" 12 #include "modules/ModulesExport.h"
14 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
15 14
16 namespace blink { 15 namespace blink {
17 16
17 class LocalFrame;
18 class ExecutionContext; 18 class ExecutionContext;
yhirano 2016/07/29 02:19:23 +class Resource;
Gleb Lanbin 2016/07/29 19:23:14 Done.
19 class ScriptPromiseResolver; 19 class ResourceFetcher;
20 class WorkerScriptLoader;
21 class WorkletGlobalScopeProxy; 20 class WorkletGlobalScopeProxy;
22 21
23 class MODULES_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, public ScriptWrappable, public ActiveDOMObject { 22 class MODULES_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, public ScriptWrappable, public ActiveDOMObject {
24 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
25 USING_GARBAGE_COLLECTED_MIXIN(Worklet); 24 USING_GARBAGE_COLLECTED_MIXIN(Worklet);
26 WTF_MAKE_NONCOPYABLE(Worklet); 25 WTF_MAKE_NONCOPYABLE(Worklet);
27 public: 26 public:
28 virtual WorkletGlobalScopeProxy* workletGlobalScopeProxy() const = 0; 27 virtual WorkletGlobalScopeProxy* workletGlobalScopeProxy() const = 0;
29 28
30 // Worklet 29 // Worklet
31 ScriptPromise import(ScriptState*, const String& url); 30 ScriptPromise import(ScriptState*, const String& url);
32 31
32 void notifyFinished(Resource*);
33
33 // ActiveDOMObject 34 // ActiveDOMObject
34 void stop() final; 35 void stop() final;
35 36
36 DECLARE_VIRTUAL_TRACE(); 37 DECLARE_VIRTUAL_TRACE();
37 38
38 protected: 39 protected:
39 // The ExecutionContext argument is the parent document of the Worklet. The 40 // The ExecutionContext argument is the parent document of the Worklet. The
40 // Worklet inherits the url and userAgent from the document. 41 // Worklet inherits the url and userAgent from the document.
41 explicit Worklet(ExecutionContext*); 42 explicit Worklet(ExecutionContext*, LocalFrame*);
42 43
43 private: 44 private:
44 void onResponse(WorkerScriptLoader*); 45 ResourceFetcher* fetcher() const { return m_fetcher.get(); }
45 void onFinished(WorkerScriptLoader*, ScriptPromiseResolver*);
46 46
47 Vector<RefPtr<WorkerScriptLoader>> m_scriptLoaders; 47 Member<ResourceFetcher> m_fetcher;
48 HeapVector<Member<ScriptPromiseResolver>> m_resolvers; 48 HeapVector<Member<Resource>> m_resources;
49 }; 49 };
50 50
51 } // namespace blink 51 } // namespace blink
52 52
53 #endif // Worklet_h 53 #endif // Worklet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698