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

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

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

Powered by Google App Engine
This is Rietveld 408576698