From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/loader/WorkerThreadableLoader.h | 61 +++++++++++--------------- 1 file changed, 25 insertions(+), 36 deletions(-) (limited to 'Source/WebCore/loader/WorkerThreadableLoader.h') diff --git a/Source/WebCore/loader/WorkerThreadableLoader.h b/Source/WebCore/loader/WorkerThreadableLoader.h index 4db0f4534..c0a570527 100644 --- a/Source/WebCore/loader/WorkerThreadableLoader.h +++ b/Source/WebCore/loader/WorkerThreadableLoader.h @@ -28,41 +28,35 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WorkerThreadableLoader_h -#define WorkerThreadableLoader_h +#pragma once #include "ThreadableLoader.h" #include "ThreadableLoaderClient.h" #include "ThreadableLoaderClientWrapper.h" - -#include -#include -#include -#include #include #include namespace WebCore { + class ContentSecurityPolicy; class ResourceError; class ResourceRequest; + class SecurityOrigin; class WorkerGlobalScope; class WorkerLoaderProxy; - struct CrossThreadResourceResponseData; - struct CrossThreadResourceRequestData; class WorkerThreadableLoader : public RefCounted, public ThreadableLoader { WTF_MAKE_FAST_ALLOCATED; public: - static void loadResourceSynchronously(WorkerGlobalScope*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); - static PassRefPtr create(WorkerGlobalScope* workerGlobalScope, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) + static void loadResourceSynchronously(WorkerGlobalScope&, ResourceRequest&&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static Ref create(WorkerGlobalScope& workerGlobalScope, ThreadableLoaderClient& client, const String& taskMode, ResourceRequest&& request, const ThreadableLoaderOptions& options, const String& referrer) { - return adoptRef(new WorkerThreadableLoader(workerGlobalScope, client, taskMode, request, options)); + return adoptRef(*new WorkerThreadableLoader(workerGlobalScope, client, taskMode, WTFMove(request), options, referrer)); } ~WorkerThreadableLoader(); - virtual void cancel() override; + void cancel() override; bool done() const { return m_workerClientWrapper->done(); } @@ -70,8 +64,8 @@ namespace WebCore { using RefCounted::deref; protected: - virtual void refThreadableLoader() override { ref(); } - virtual void derefThreadableLoader() override { deref(); } + void refThreadableLoader() override { ref(); } + void derefThreadableLoader() override { deref(); } private: // Creates a loader on the main thread and bridges communication between @@ -90,13 +84,12 @@ namespace WebCore { // case 2. xhr gets aborted and the worker context continues running. // The ThreadableLoaderClientWrapper has the underlying client cleared, so no more calls // go through it. All tasks posted from the worker object's thread to the worker context's - // thread do "ThreadableLoaderClientWrapper::ref" (automatically inside of the cross thread copy - // done in createCallbackTask), so the ThreadableLoaderClientWrapper instance is there until all - // tasks are executed. + // thread contain the RefPtr object, so the + // ThreadableLoaderClientWrapper instance is there until all tasks are executed. class MainThreadBridge : public ThreadableLoaderClient { public: // All executed on the worker context's thread. - MainThreadBridge(PassRefPtr, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&, const String& outgoingReferrer); + MainThreadBridge(ThreadableLoaderClientWrapper&, WorkerLoaderProxy&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& outgoingReferrer, const SecurityOrigin*, const ContentSecurityPolicy*); void cancel(); void destroy(); @@ -105,21 +98,19 @@ namespace WebCore { void clearClientWrapper(); // All executed on the main thread. - static void mainThreadDestroy(ScriptExecutionContext*, MainThreadBridge*); - ~MainThreadBridge(); - - static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, PassOwnPtr, ThreadableLoaderOptions, const String& outgoingReferrer); - static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*); - virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; - virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override; - virtual void didReceiveData(const char*, int dataLength) override; - virtual void didFinishLoading(unsigned long identifier, double finishTime) override; - virtual void didFail(const ResourceError&) override; - virtual void didFailAccessControlCheck(const ResourceError&) override; - virtual void didFailRedirectCheck() override; + void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) override; + void didReceiveResponse(unsigned long identifier, const ResourceResponse&) override; + void didReceiveData(const char*, int dataLength) override; + void didFinishLoading(unsigned long identifier, double finishTime) override; + void didFail(const ResourceError&) override; + +#if ENABLE(WEB_TIMING) + void didFinishTiming(const ResourceTiming&) override; +#endif // Only to be used on the main thread. RefPtr m_mainThreadLoader; + bool m_loadingFinished { false }; // ThreadableLoaderClientWrapper is to be used on the worker context thread. // The ref counting is done on either thread. @@ -132,13 +123,11 @@ namespace WebCore { String m_taskMode; }; - WorkerThreadableLoader(WorkerGlobalScope*, ThreadableLoaderClient*, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); + WorkerThreadableLoader(WorkerGlobalScope&, ThreadableLoaderClient&, const String& taskMode, ResourceRequest&&, const ThreadableLoaderOptions&, const String& referrer); - RefPtr m_workerGlobalScope; - RefPtr m_workerClientWrapper; + Ref m_workerGlobalScope; + Ref m_workerClientWrapper; MainThreadBridge& m_bridge; }; } // namespace WebCore - -#endif // WorkerThreadableLoader_h -- cgit v1.2.1