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

Unified Diff: Source/core/workers/WorkerScriptLoader.h

Issue 1190133002: Remove WorkerScriptLoaderClient and inheritances (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review #6 and #7 Created 5 years, 6 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 | « Source/core/workers/WorkerGlobalScope.cpp ('k') | Source/core/workers/WorkerScriptLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/workers/WorkerGlobalScope.cpp ('k') | Source/core/workers/WorkerScriptLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698