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

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

Issue 2871513002: Worklet: Lazily create PaintWorkletGlobalScopes (Closed)
Patch Set: clean up 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
(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 #include "core/workers/WorkletGlobalScopeManager.h"
6
7 #include "core/workers/WorkletPendingTasks.h"
8
9 namespace blink {
10
11 void WorkletGlobalScopeManager::AddGlobalScope(
12 std::unique_ptr<WorkletGlobalScopeProxy> proxy) {
13 proxies_.insert(std::move(proxy));
14 }
15
16 WorkletGlobalScopeProxy* WorkletGlobalScopeManager::FindAvailableGlobalScope()
17 const {
18 DCHECK(IsMainThread());
19 // TODO(nhiroki): Support the case where there are multiple global scopes.
20 DCHECK_EQ(1u, GetNumberOfGlobalScopes());
21 return proxies_.begin()->get();
22 }
23
24 void WorkletGlobalScopeManager::AddModuleToGlobalScopes(
25 const KURL& module_url_record,
26 WebURLRequest::FetchCredentialsMode credentials_mode,
27 WorkletPendingTasks* pending_tasks) {
28 DCHECK(IsMainThread());
29 for (const auto& proxy : proxies_) {
30 proxy->FetchAndInvokeScript(module_url_record, credentials_mode,
31 pending_tasks);
32 }
33 }
34
35 void WorkletGlobalScopeManager::TerminateGlobalScopes() {
36 DCHECK(IsMainThread());
37 for (const auto& proxy : proxies_)
38 proxy->TerminateWorkletGlobalScope();
39 }
40
41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698