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

Side by Side Diff: third_party/WebKit/Source/modules/worklet/WorkletScriptLoader.cpp

Issue 2178223002: Refactor Worklet class to use ScriptResource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: set m_fetcher in initialization list, s/override/final, copyright etc. Created 4 years, 4 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 2016 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 "modules/worklet/WorkletScriptLoader.h"
6
7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "core/dom/DOMException.h"
9 #include "core/dom/ExceptionCode.h"
10 #include "core/workers/WorkletGlobalScopeProxy.h"
11 #include "modules/worklet/Worklet.h"
12
13 namespace blink {
14
15 WorkletScriptLoader::WorkletScriptLoader(ScriptPromiseResolver* resolver, Workle tGlobalScopeProxy* workletGlobalScopeProxy,
16 Worklet* worklet)
17 : m_resolver(resolver)
18 , m_host(worklet),
19 , m_workletGlobalScopeProxy(workletGlobalScopeProxy)
20 {
21 }
22
23 void WorkletScriptLoader::notifyFinished(Resource* resource)
24 {
25 if (resource->errorOccurred()) {
26 m_resolver->reject(DOMException::create(NetworkError));
27 } else {
28 DCHECK(resource->isLoaded());
29 m_workletGlobalScopeProxy->evaluateScript(ScriptSourceCode(toScriptResou rce(resource)));
30 m_resolver->resolve();
31 }
32 m_host->notifyFinished(resource);
33 }
34
35 DEFINE_TRACE(WorkletScriptLoader)
36 {
37 visitor->trace(m_resolver);
38 visitor->trace(m_host);
39 ScriptResourceClient::trace(visitor);
40 }
41
42 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698