OLD | NEW |
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/loader/fetch/ResourceLoaderOptions.h" | 10 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void WorkletScriptLoader::NotifyFinished(Resource* resource) { | 45 void WorkletScriptLoader::NotifyFinished(Resource* resource) { |
46 DCHECK(IsMainThread()); | 46 DCHECK(IsMainThread()); |
47 DCHECK(!was_script_load_complete_); | 47 DCHECK(!was_script_load_complete_); |
48 ClearResource(); | 48 ClearResource(); |
49 was_script_load_complete_ = true; | 49 was_script_load_complete_ = true; |
50 if (!resource || resource->ErrorOccurred()) { | 50 if (!resource || resource->ErrorOccurred()) { |
51 client_->NotifyWorkletScriptLoadingFinished(this, ScriptSourceCode()); | 51 client_->NotifyWorkletScriptLoadingFinished(this, ScriptSourceCode()); |
52 } else { | 52 } else { |
53 was_script_load_successful_ = true; | 53 was_script_load_successful_ = true; |
54 client_->NotifyWorkletScriptLoadingFinished( | 54 client_->NotifyWorkletScriptLoadingFinished( |
55 this, ScriptSourceCode(static_cast<ScriptResource*>(resource))); | 55 this, ScriptSourceCode( |
| 56 static_cast<ScriptResource*>(resource)->ResourceData())); |
56 } | 57 } |
57 fetcher_ = nullptr; | 58 fetcher_ = nullptr; |
58 client_ = nullptr; | 59 client_ = nullptr; |
59 } | 60 } |
60 | 61 |
61 bool WorkletScriptLoader::WasScriptLoadSuccessful() const { | 62 bool WorkletScriptLoader::WasScriptLoadSuccessful() const { |
62 DCHECK(was_script_load_complete_); | 63 DCHECK(was_script_load_complete_); |
63 return was_script_load_successful_; | 64 return was_script_load_successful_; |
64 } | 65 } |
65 | 66 |
66 DEFINE_TRACE(WorkletScriptLoader) { | 67 DEFINE_TRACE(WorkletScriptLoader) { |
67 visitor->Trace(fetcher_); | 68 visitor->Trace(fetcher_); |
68 visitor->Trace(client_); | 69 visitor->Trace(client_); |
69 ResourceOwner<ScriptResource, ScriptResourceClient>::Trace(visitor); | 70 ResourceOwner<ScriptResource, ScriptResourceClient>::Trace(visitor); |
70 } | 71 } |
71 | 72 |
72 } // namespace blink | 73 } // namespace blink |
OLD | NEW |