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

Unified Diff: third_party/WebKit/Source/core/workers/WorkletScriptLoader.cpp

Issue 2659033002: Worklet: Move WorkletScriptLoader from core/workers to core/loader (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkletScriptLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/workers/WorkletScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkletScriptLoader.cpp b/third_party/WebKit/Source/core/workers/WorkletScriptLoader.cpp
deleted file mode 100644
index b9ec6b5149c189d1fbfafe8c023966edd8ce9c83..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/workers/WorkletScriptLoader.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "core/workers/WorkletScriptLoader.h"
-
-#include "bindings/core/v8/ScriptSourceCode.h"
-#include "core/loader/FrameFetchContext.h"
-#include "platform/loader/fetch/FetchInitiatorTypeNames.h"
-#include "wtf/WTF.h"
-
-namespace blink {
-
-WorkletScriptLoader::WorkletScriptLoader(ResourceFetcher* fetcher,
- Client* client)
- : m_fetcher(fetcher), m_client(client) {}
-
-void WorkletScriptLoader::fetchScript(const String& scriptURL) {
- DCHECK(isMainThread());
- DCHECK(!resource());
- DCHECK(!m_wasScriptLoadComplete);
-
- ResourceRequest resourceRequest(scriptURL);
- resourceRequest.setRequestContext(WebURLRequest::RequestContextScript);
- FetchRequest request(resourceRequest, FetchInitiatorTypeNames::internal);
- ScriptResource* resource = ScriptResource::fetch(request, m_fetcher);
- if (!resource) {
- notifyFinished(nullptr);
- return;
- }
- setResource(resource);
- // notifyFinished() will be called later.
-}
-
-void WorkletScriptLoader::cancel() {
- DCHECK(isMainThread());
- if (!resource() || m_wasScriptLoadComplete)
- return;
- notifyFinished(nullptr);
-}
-
-void WorkletScriptLoader::notifyFinished(Resource* resource) {
- DCHECK(isMainThread());
- DCHECK(!m_wasScriptLoadComplete);
- clearResource();
- m_wasScriptLoadComplete = true;
- if (!resource || resource->errorOccurred()) {
- m_client->notifyWorkletScriptLoadingFinished(this, ScriptSourceCode());
- } else {
- m_wasScriptLoadSuccessful = true;
- m_client->notifyWorkletScriptLoadingFinished(
- this, ScriptSourceCode(static_cast<ScriptResource*>(resource)));
- }
- m_fetcher = nullptr;
- m_client = nullptr;
-}
-
-bool WorkletScriptLoader::wasScriptLoadSuccessful() const {
- DCHECK(m_wasScriptLoadComplete);
- return m_wasScriptLoadSuccessful;
-}
-
-DEFINE_TRACE(WorkletScriptLoader) {
- visitor->trace(m_fetcher);
- visitor->trace(m_client);
- ResourceOwner<ScriptResource, ScriptResourceClient>::trace(visitor);
-}
-
-} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkletScriptLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698