| 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 #ifndef WorkletScriptLoader_h | 5 #ifndef WorkletScriptLoader_h |
| 6 #define WorkletScriptLoader_h | 6 #define WorkletScriptLoader_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/loader/resource/ScriptResource.h" | 9 #include "core/loader/resource/ScriptResource.h" |
| 10 #include "platform/loader/fetch/ResourceClient.h" | 10 #include "platform/loader/fetch/ResourceClient.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void FetchScript(const String& script_url); | 47 void FetchScript(const String& script_url); |
| 48 | 48 |
| 49 // Cancels resource loading and synchronously calls | 49 // Cancels resource loading and synchronously calls |
| 50 // Client::notifyWorkletScriptLoadingFinished(). | 50 // Client::notifyWorkletScriptLoadingFinished(). |
| 51 void Cancel(); | 51 void Cancel(); |
| 52 | 52 |
| 53 // Returns true if a script was successfully loaded. This should be called | 53 // Returns true if a script was successfully loaded. This should be called |
| 54 // after Client::notifyWorkletScriptLoadingFinished() is called. | 54 // after Client::notifyWorkletScriptLoadingFinished() is called. |
| 55 bool WasScriptLoadSuccessful() const; | 55 bool WasScriptLoadSuccessful() const; |
| 56 | 56 |
| 57 void set_request_id(int32_t request_id) { request_id_ = request_id; } | |
| 58 int32_t request_id() const { return request_id_; } | |
| 59 | |
| 60 DECLARE_TRACE(); | 57 DECLARE_TRACE(); |
| 61 | 58 |
| 62 private: | 59 private: |
| 63 WorkletScriptLoader(ResourceFetcher*, Client*); | 60 WorkletScriptLoader(ResourceFetcher*, Client*); |
| 64 | 61 |
| 65 // ResourceClient | 62 // ResourceClient |
| 66 void NotifyFinished(Resource*) final; | 63 void NotifyFinished(Resource*) final; |
| 67 String DebugName() const final { return "WorkletLoader"; } | 64 String DebugName() const final { return "WorkletLoader"; } |
| 68 | 65 |
| 69 Member<ResourceFetcher> fetcher_; | 66 Member<ResourceFetcher> fetcher_; |
| 70 Member<Client> client_; | 67 Member<Client> client_; |
| 71 | 68 |
| 72 // The client of this loader can freely use this field to identify a fetch | |
| 73 // request. | |
| 74 int32_t request_id_ = -1; | |
| 75 | |
| 76 bool was_script_load_successful_ = false; | 69 bool was_script_load_successful_ = false; |
| 77 bool was_script_load_complete_ = false; | 70 bool was_script_load_complete_ = false; |
| 78 }; | 71 }; |
| 79 | 72 |
| 80 } // namespace blink | 73 } // namespace blink |
| 81 | 74 |
| 82 #endif // WorkletScriptLoader_h | 75 #endif // WorkletScriptLoader_h |
| OLD | NEW |