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

Side by Side Diff: third_party/WebKit/Source/core/loader/WorkletScriptLoader.cpp

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Fix 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 #include "core/loader/WorkletScriptLoader.h" 5 #include "core/loader/WorkletScriptLoader.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "core/loader/FrameFetchContext.h" 8 #include "core/loader/FrameFetchContext.h"
9 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" 9 #include "platform/loader/fetch/FetchInitiatorTypeNames.h"
10 #include "platform/wtf/WTF.h" 10 #include "platform/wtf/WTF.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 void WorkletScriptLoader::NotifyFinished(Resource* resource) { 42 void WorkletScriptLoader::NotifyFinished(Resource* resource) {
43 DCHECK(IsMainThread()); 43 DCHECK(IsMainThread());
44 DCHECK(!was_script_load_complete_); 44 DCHECK(!was_script_load_complete_);
45 ClearResource(); 45 ClearResource();
46 was_script_load_complete_ = true; 46 was_script_load_complete_ = true;
47 if (!resource || resource->ErrorOccurred()) { 47 if (!resource || resource->ErrorOccurred()) {
48 client_->NotifyWorkletScriptLoadingFinished(this, ScriptSourceCode()); 48 client_->NotifyWorkletScriptLoadingFinished(this, ScriptSourceCode());
49 } else { 49 } else {
50 was_script_load_successful_ = true; 50 was_script_load_successful_ = true;
51 client_->NotifyWorkletScriptLoadingFinished( 51 client_->NotifyWorkletScriptLoadingFinished(
52 this, ScriptSourceCode(static_cast<ScriptResource*>(resource))); 52 this, ScriptSourceCode(
53 static_cast<ScriptResource*>(resource)->ResourceData()));
53 } 54 }
54 fetcher_ = nullptr; 55 fetcher_ = nullptr;
55 client_ = nullptr; 56 client_ = nullptr;
56 } 57 }
57 58
58 bool WorkletScriptLoader::WasScriptLoadSuccessful() const { 59 bool WorkletScriptLoader::WasScriptLoadSuccessful() const {
59 DCHECK(was_script_load_complete_); 60 DCHECK(was_script_load_complete_);
60 return was_script_load_successful_; 61 return was_script_load_successful_;
61 } 62 }
62 63
63 DEFINE_TRACE(WorkletScriptLoader) { 64 DEFINE_TRACE(WorkletScriptLoader) {
64 visitor->Trace(fetcher_); 65 visitor->Trace(fetcher_);
65 visitor->Trace(client_); 66 visitor->Trace(client_);
66 ResourceOwner<ScriptResource, ScriptResourceClient>::Trace(visitor); 67 ResourceOwner<ScriptResource, ScriptResourceClient>::Trace(visitor);
67 } 68 }
68 69
69 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698