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

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: add missing files 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
18 class ExecutionContext; 17 class ExecutionContext;
19 class ScriptPromiseResolver; 18 class ResourceFetcher;
20 class WorkerScriptLoader;
21 class WorkletGlobalScopeProxy; 19 class WorkletGlobalScopeProxy;
22 20
23 class MODULES_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, public ScriptWrappable, public ActiveDOMObject { 21 class MODULES_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, public ScriptWrappable, public ActiveDOMObject {
24 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
25 USING_GARBAGE_COLLECTED_MIXIN(Worklet); 23 USING_GARBAGE_COLLECTED_MIXIN(Worklet);
26 WTF_MAKE_NONCOPYABLE(Worklet); 24 WTF_MAKE_NONCOPYABLE(Worklet);
27 public: 25 public:
28 virtual WorkletGlobalScopeProxy* workletGlobalScopeProxy() const = 0; 26 virtual WorkletGlobalScopeProxy* workletGlobalScopeProxy() const = 0;
29 27
30 // Worklet 28 // Worklet
31 ScriptPromise import(ScriptState*, const String& url); 29 ScriptPromise import(ScriptState*, const String& url);
32 30
31 void notifyFinished(Resource*);
32
33 // ActiveDOMObject 33 // ActiveDOMObject
34 void stop() final; 34 void stop() final;
35 35
36 DECLARE_VIRTUAL_TRACE(); 36 DECLARE_VIRTUAL_TRACE();
37 37
38 protected: 38 protected:
39 // The ExecutionContext argument is the parent document of the Worklet. The 39 // The ExecutionContext argument is the parent document of the Worklet. The
40 // Worklet inherits the url and userAgent from the document. 40 // Worklet inherits the url and userAgent from the document.
41 explicit Worklet(ExecutionContext*); 41 explicit Worklet(ExecutionContext*, LocalFrame*);
yhirano 2016/07/27 09:09:46 Could you tell me when the frame is null?
42 42
43 private: 43 private:
44 void onResponse(WorkerScriptLoader*); 44 ResourceFetcher* fetcher() const { return m_fetcher.get(); }
45 void onFinished(WorkerScriptLoader*, ScriptPromiseResolver*);
46 45
47 Vector<RefPtr<WorkerScriptLoader>> m_scriptLoaders; 46 Member<ResourceFetcher> m_fetcher;
48 HeapVector<Member<ScriptPromiseResolver>> m_resolvers; 47 HeapVector<Member<Resource>> m_resources;
49 }; 48 };
50 49
51 } // namespace blink 50 } // namespace blink
52 51
53 #endif // Worklet_h 52 #endif // Worklet_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698