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

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

Issue 2871513002: Worklet: Lazily create PaintWorkletGlobalScopes (Closed)
Patch Set: clean up 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WorkletGlobalScopeManager_h
6 #define WorkletGlobalScopeManager_h
7
8 #include <memory>
9 #include "core/CoreExport.h"
10 #include "core/workers/WorkletGlobalScopeProxy.h"
11 #include "platform/heap/GarbageCollected.h"
12 #include "public/platform/WebURLRequest.h"
13
14 namespace blink {
15
16 class WorkletPendingTasks;
17
18 // Manages proxies to worklet global scopes on the main thread. Owned by the
19 // Worklet class.
20 class CORE_EXPORT WorkletGlobalScopeManager
21 : public GarbageCollectedFinalized<WorkletGlobalScopeManager> {
22 WTF_MAKE_NONCOPYABLE(WorkletGlobalScopeManager);
23
24 public:
25 WorkletGlobalScopeManager() = default;
26 virtual ~WorkletGlobalScopeManager() = default;
27
28 // Adds a global scope to the managed set.
29 void AddGlobalScope(std::unique_ptr<WorkletGlobalScopeProxy>);
kinuko 2017/05/24 06:53:40 nit: it looks we can remove 'GlobalScope' part fro
nhiroki 2017/05/24 08:11:22 The latest patchset removed this and other functio
30
31 // Returns one of available global scopes.
32 WorkletGlobalScopeProxy* FindAvailableGlobalScope() const;
33
34 // Fetches and evaluates module scripts on all global scopes.
35 void AddModuleToGlobalScopes(const KURL& module_url_record,
36 WebURLRequest::FetchCredentialsMode,
37 WorkletPendingTasks*);
38
39 // Terminates all global scopes.
40 void TerminateGlobalScopes();
41
42 size_t GetNumberOfGlobalScopes() const { return proxies_.size(); }
kinuko 2017/05/24 06:53:39 It looks we can also simply let MainThreadWorklet
nhiroki 2017/05/24 08:11:22 Done.
43
44 DEFINE_INLINE_TRACE() {}
45
46 private:
47 // "A Worklet has a list of the worklet's WorkletGlobalScopes. Initially this
48 // list is empty; it is populated when the user agent chooses to create its
49 // WorkletGlobalScope."
50 // https://drafts.css-houdini.org/worklets/#worklet-section
51 // TODO(nhiroki): Make (Paint)WorkletGlobalScopeProxy GC-managed object to
52 // avoid that GC graphs are disjointed (https://crbug.com/719775).
53 WTF::HashSet<std::unique_ptr<WorkletGlobalScopeProxy>> proxies_;
54 };
55
56 } // namespace blink
57
58 #endif // WorkletGlobalScopeManager_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/Worklet.h ('k') | third_party/WebKit/Source/core/workers/WorkletGlobalScopeManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698