| Index: Source/core/workers/WorkerScriptLoader.h
|
| diff --git a/Source/core/workers/WorkerScriptLoader.h b/Source/core/workers/WorkerScriptLoader.h
|
| index f6154cc4a39abb91672961ab409f6da42f01bc24..c8c8f13ff34d6f1625eecf4bc867104cfc7cc9c4 100644
|
| --- a/Source/core/workers/WorkerScriptLoader.h
|
| +++ b/Source/core/workers/WorkerScriptLoader.h
|
| @@ -35,8 +35,8 @@
|
| #include "platform/weborigin/KURL.h"
|
| #include "public/platform/WebURLRequest.h"
|
| #include "wtf/FastAllocBase.h"
|
| +#include "wtf/Functional.h"
|
| #include "wtf/PassRefPtr.h"
|
| -#include "wtf/RefCounted.h"
|
| #include "wtf/text/StringBuilder.h"
|
|
|
| namespace blink {
|
| @@ -46,18 +46,18 @@ class ResourceRequest;
|
| class ResourceResponse;
|
| class ExecutionContext;
|
| class TextResourceDecoder;
|
| -class WorkerScriptLoaderClient;
|
|
|
| -class CORE_EXPORT WorkerScriptLoader final : public RefCounted<WorkerScriptLoader>, public ThreadableLoaderClient {
|
| +class CORE_EXPORT WorkerScriptLoader final : public ThreadableLoaderClient {
|
| WTF_MAKE_FAST_ALLOCATED(WorkerScriptLoader);
|
| public:
|
| - static PassRefPtr<WorkerScriptLoader> create()
|
| - {
|
| - return adoptRef(new WorkerScriptLoader());
|
| - }
|
| + WorkerScriptLoader();
|
| + ~WorkerScriptLoader() override;
|
|
|
| void loadSynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPolicy);
|
| - void loadAsynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*);
|
| + // TODO: finishedCallback is not currently guaranteed to be invoked if used
|
| + // from worker context and the worker shuts down in the middle of an
|
| + // operation. This will cause leaks when we support nested workers.
|
| + void loadAsynchronously(ExecutionContext&, const KURL&, CrossOriginRequestPolicy, PassOwnPtr<Closure> responseCallback, PassOwnPtr<Closure> finishedCallback);
|
|
|
| void notifyError();
|
|
|
| @@ -65,17 +65,16 @@ public:
|
| // is in progress.
|
| void cancel();
|
|
|
| - void setClient(WorkerScriptLoaderClient* client) { m_client = client; }
|
| -
|
| String script();
|
| const KURL& url() const { return m_url; }
|
| const KURL& responseURL() const;
|
| bool failed() const { return m_failed; }
|
| unsigned long identifier() const { return m_identifier; }
|
| + long long appCacheID() const { return m_appCacheID; }
|
| +
|
| PassOwnPtr<Vector<char>> releaseCachedMetadata() { return m_cachedMetadata.release(); }
|
| const Vector<char>* cachedMetadata() const { return m_cachedMetadata.get(); }
|
|
|
| - void setContentSecurityPolicy(PassRefPtr<ContentSecurityPolicy> policy) { m_contentSecurityPolicy = policy; };
|
| PassRefPtr<ContentSecurityPolicy> contentSecurityPolicy() { return m_contentSecurityPolicy; }
|
| PassRefPtr<ContentSecurityPolicy> releaseContentSecurityPolicy() { return m_contentSecurityPolicy.release(); }
|
|
|
| @@ -90,17 +89,15 @@ public:
|
| void setRequestContext(WebURLRequest::RequestContext requestContext) { m_requestContext = requestContext; }
|
|
|
| private:
|
| - friend class WTF::RefCounted<WorkerScriptLoader>;
|
| -
|
| - WorkerScriptLoader();
|
| - ~WorkerScriptLoader() override;
|
| -
|
| PassOwnPtr<ResourceRequest> createResourceRequest();
|
| void notifyFinished();
|
|
|
| void processContentSecurityPolicy(const ResourceResponse&);
|
|
|
| - WorkerScriptLoaderClient* m_client;
|
| + // Callbacks for loadAsynchronously().
|
| + OwnPtr<Closure> m_responseCallback;
|
| + OwnPtr<Closure> m_finishedCallback;
|
| +
|
| RefPtr<ThreadableLoader> m_threadableLoader;
|
| String m_responseEncoding;
|
| OwnPtr<TextResourceDecoder> m_decoder;
|
| @@ -109,6 +106,7 @@ private:
|
| KURL m_responseURL;
|
| bool m_failed;
|
| unsigned long m_identifier;
|
| + long long m_appCacheID;
|
| bool m_finishing;
|
| OwnPtr<Vector<char>> m_cachedMetadata;
|
| WebURLRequest::RequestContext m_requestContext;
|
|
|