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

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

Issue 2826313003: Worklet: Enable module script loading for main thread worklets (Closed)
Patch Set: update comments Created 3 years, 6 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 MainThreadWorkletGlobalScope_h 5 #ifndef MainThreadWorkletGlobalScope_h
6 #define MainThreadWorkletGlobalScope_h 6 #define MainThreadWorkletGlobalScope_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/dom/ContextLifecycleObserver.h" 9 #include "core/dom/ContextLifecycleObserver.h"
10 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
11 #include "core/loader/WorkletScriptLoader.h"
12 #include "core/workers/WorkletGlobalScope.h" 11 #include "core/workers/WorkletGlobalScope.h"
13 #include "core/workers/WorkletPendingTasks.h" 12 #include "core/workers/WorkletPendingTasks.h"
14 #include "public/platform/WebURLRequest.h" 13 #include "public/platform/WebURLRequest.h"
15 14
16 namespace blink { 15 namespace blink {
17 16
18 class ConsoleMessage; 17 class ConsoleMessage;
19 class LocalFrame; 18 class LocalFrame;
20 class ScriptSourceCode;
21 19
22 class CORE_EXPORT MainThreadWorkletGlobalScope 20 class CORE_EXPORT MainThreadWorkletGlobalScope
23 : public WorkletGlobalScope, 21 : public WorkletGlobalScope,
24 public WorkletScriptLoader::Client,
25 public ContextClient { 22 public ContextClient {
26 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope); 23 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope);
27 24
28 public: 25 public:
29 MainThreadWorkletGlobalScope(LocalFrame*, 26 MainThreadWorkletGlobalScope(LocalFrame*,
30 const KURL&, 27 const KURL&,
31 const String& user_agent, 28 const String& user_agent,
32 PassRefPtr<SecurityOrigin>, 29 PassRefPtr<SecurityOrigin>,
33 v8::Isolate*); 30 v8::Isolate*);
34 ~MainThreadWorkletGlobalScope() override; 31 ~MainThreadWorkletGlobalScope() override;
35 bool IsMainThreadWorkletGlobalScope() const final { return true; } 32 bool IsMainThreadWorkletGlobalScope() const final { return true; }
36 33
37 // WorkerOrWorkletGlobalScope 34 // WorkerOrWorkletGlobalScope
38 void ReportFeature(UseCounter::Feature) override; 35 void ReportFeature(UseCounter::Feature) override;
39 void ReportDeprecation(UseCounter::Feature) override; 36 void ReportDeprecation(UseCounter::Feature) override;
40 WorkerThread* GetThread() const final; 37 WorkerThread* GetThread() const final;
41 38
42 void FetchAndInvokeScript(const KURL& module_url_record, 39 void FetchAndInvokeScript(const KURL& module_url_record,
43 WebURLRequest::FetchCredentialsMode, 40 WebURLRequest::FetchCredentialsMode,
44 WorkletPendingTasks*); 41 WorkletPendingTasks*);
45 void Terminate(); 42 void Terminate();
46 43
47 // WorkletScriptLoader::Client
48 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*,
49 const ScriptSourceCode&) final;
50
51 // ExecutionContext 44 // ExecutionContext
52 void AddConsoleMessage(ConsoleMessage*) final; 45 void AddConsoleMessage(ConsoleMessage*) final;
53 void ExceptionThrown(ErrorEvent*) final; 46 void ExceptionThrown(ErrorEvent*) final;
54 CoreProbeSink* GetProbeSink() final; 47 CoreProbeSink* GetProbeSink() final;
55 48
56 DECLARE_VIRTUAL_TRACE(); 49 DECLARE_VIRTUAL_TRACE();
57
58 private:
59 HeapHashMap<Member<WorkletScriptLoader>, Member<WorkletPendingTasks>>
60 loader_map_;
61 }; 50 };
62 51
63 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, 52 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope,
64 ExecutionContext, 53 ExecutionContext,
65 context, 54 context,
66 context->IsMainThreadWorkletGlobalScope(), 55 context->IsMainThreadWorkletGlobalScope(),
67 context.IsMainThreadWorkletGlobalScope()); 56 context.IsMainThreadWorkletGlobalScope());
68 57
69 } // namespace blink 58 } // namespace blink
70 59
71 #endif // MainThreadWorkletGlobalScope_h 60 #endif // MainThreadWorkletGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698