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

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: synced to the head 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
« no previous file with comments | « third_party/WebKit/Source/modules/worklet/WorkletScriptLoader.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/dom/DOMException.h"
8 #include "core/dom/ExceptionCode.h"
9 #include "core/fetch/ResourceLoader.h"
10 #include "modules/worklet/Worklet.h"
11
12 namespace blink {
13
14 WorkletScriptLoader::WorkletScriptLoader(ScriptPromiseResolver* resolver, Workle t* worklet, ScriptResource* resource)
15 : m_resolver(resolver)
16 , m_host(worklet)
17 {
18 setResource(resource);
19 }
20
21 void WorkletScriptLoader::cancel()
22 {
23 if (resource()) {
24 resource()->loader()->cancel();
25 clearResource();
26 }
27 }
28
29 void WorkletScriptLoader::notifyFinished(Resource* resource)
30 {
31 DCHECK(this->resource() == resource);
32
33 m_host->notifyFinished(this);
34 if (resource->errorOccurred()) {
35 m_resolver->reject(DOMException::create(NetworkError));
36 } else {
37 DCHECK(resource->isLoaded());
38 m_resolver->resolve();
39 }
40 clearResource();
41 }
42
43 DEFINE_TRACE(WorkletScriptLoader)
44 {
45 visitor->trace(m_resolver);
46 visitor->trace(m_host);
47 ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor);
48 }
49
50 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/worklet/WorkletScriptLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698