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

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

Issue 2839123003: Worklet: Introduce "pending tasks struct" concept defined in the Worklet spec (Closed)
Patch Set: address review 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/WorkletGlobalScopeProxy.h" 13 #include "core/workers/WorkletGlobalScopeProxy.h"
14 #include "core/workers/WorkletObjectProxy.h" 14 #include "core/workers/WorkletPendingTasks.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class ConsoleMessage; 18 class ConsoleMessage;
19 class LocalFrame; 19 class LocalFrame;
20 class ScriptSourceCode; 20 class ScriptSourceCode;
21 21
22 class CORE_EXPORT MainThreadWorkletGlobalScope 22 class CORE_EXPORT MainThreadWorkletGlobalScope
23 : public WorkletGlobalScope, 23 : public WorkletGlobalScope,
24 public WorkletGlobalScopeProxy, 24 public WorkletGlobalScopeProxy,
25 public WorkletScriptLoader::Client, 25 public WorkletScriptLoader::Client,
26 public ContextClient { 26 public ContextClient {
27 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope); 27 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorkletGlobalScope);
28 28
29 public: 29 public:
30 MainThreadWorkletGlobalScope(LocalFrame*, 30 MainThreadWorkletGlobalScope(LocalFrame*,
31 const KURL&, 31 const KURL&,
32 const String& user_agent, 32 const String& user_agent,
33 PassRefPtr<SecurityOrigin>, 33 PassRefPtr<SecurityOrigin>,
34 v8::Isolate*, 34 v8::Isolate*);
35 WorkletObjectProxy*);
36 ~MainThreadWorkletGlobalScope() override; 35 ~MainThreadWorkletGlobalScope() override;
37 bool IsMainThreadWorkletGlobalScope() const final { return true; } 36 bool IsMainThreadWorkletGlobalScope() const final { return true; }
38 37
39 // WorkerOrWorkletGlobalScope 38 // WorkerOrWorkletGlobalScope
40 void CountFeature(UseCounter::Feature) final; 39 void CountFeature(UseCounter::Feature) final;
41 void CountDeprecation(UseCounter::Feature) final; 40 void CountDeprecation(UseCounter::Feature) final;
42 WorkerThread* GetThread() const final; 41 WorkerThread* GetThread() const final;
43 42
44 // WorkletGlobalScopeProxy 43 // WorkletGlobalScopeProxy
45 void FetchAndInvokeScript(int32_t request_id, const KURL& script_url) final; 44 void FetchAndInvokeScript(const KURL& module_url_record,
45 WorkletPendingTasks*) final;
46 void EvaluateScript(const ScriptSourceCode&) final; 46 void EvaluateScript(const ScriptSourceCode&) final;
47 void TerminateWorkletGlobalScope() final; 47 void TerminateWorkletGlobalScope() final;
48 48
49 // WorkletScriptLoader::Client 49 // WorkletScriptLoader::Client
50 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, 50 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*,
51 const ScriptSourceCode&) final; 51 const ScriptSourceCode&) final;
52 52
53 // ExecutionContext 53 // ExecutionContext
54 void AddConsoleMessage(ConsoleMessage*) final; 54 void AddConsoleMessage(ConsoleMessage*) final;
55 void ExceptionThrown(ErrorEvent*) final; 55 void ExceptionThrown(ErrorEvent*) final;
56 56
57 DECLARE_VIRTUAL_TRACE(); 57 DECLARE_VIRTUAL_TRACE();
58 58
59 private: 59 private:
60 HeapHashSet<Member<WorkletScriptLoader>> loader_set_; 60 HeapHashMap<Member<WorkletScriptLoader>, Member<WorkletPendingTasks>>
61 61 loader_map_;
62 Member<WorkletObjectProxy> object_proxy_;
63 }; 62 };
64 63
65 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope, 64 DEFINE_TYPE_CASTS(MainThreadWorkletGlobalScope,
66 ExecutionContext, 65 ExecutionContext,
67 context, 66 context,
68 context->IsMainThreadWorkletGlobalScope(), 67 context->IsMainThreadWorkletGlobalScope(),
69 context.IsMainThreadWorkletGlobalScope()); 68 context.IsMainThreadWorkletGlobalScope());
70 69
71 } // namespace blink 70 } // namespace blink
72 71
73 #endif // MainThreadWorkletGlobalScope_h 72 #endif // MainThreadWorkletGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698