Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / WebSharedWorkerImpl.h
index 3c04268..a13e5d7 100644 (file)
 #include "core/dom/ExecutionContext.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerReportingProxy.h"
+#include "core/workers/WorkerScriptLoaderClient.h"
 #include "core/workers/WorkerThread.h"
 #include "wtf/PassOwnPtr.h"
 #include "wtf/RefPtr.h"
 #include "wtf/WeakPtr.h"
 
+namespace WebCore {
+class ResourceResponse;
+}
+
 namespace blink {
 class WebApplicationCacheHost;
 class WebApplicationCacheHostClient;
@@ -81,14 +86,14 @@ public:
 
     // WebCore::WorkerLoaderProxy methods:
     virtual void postTaskToLoader(PassOwnPtr<WebCore::ExecutionContextTask>) OVERRIDE;
-    virtual bool postTaskForModeToWorkerGlobalScope(
-        PassOwnPtr<WebCore::ExecutionContextTask>, const WTF::String& mode) OVERRIDE;
+    virtual bool postTaskToWorkerGlobalScope(PassOwnPtr<WebCore::ExecutionContextTask>) OVERRIDE;
 
     // WebFrameClient methods to support resource loading thru the 'shadow page'.
     virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*) OVERRIDE;
+    virtual void didFinishDocumentLoad(WebFrame*) OVERRIDE;
 
     // WebSharedWorker methods:
-    virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType, long long cacheId) OVERRIDE;
+    virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType) OVERRIDE;
     virtual void connect(WebMessagePortChannel*) OVERRIDE;
     virtual void terminateWorkerContext() OVERRIDE;
     virtual void clientDestroyed() OVERRIDE;
@@ -101,6 +106,8 @@ public:
     virtual void dispatchDevToolsMessage(const WebString&) OVERRIDE;
 
 private:
+    class Loader;
+
     virtual ~WebSharedWorkerImpl();
 
     WebSharedWorkerClient* client() { return m_client->get(); }
@@ -114,6 +121,8 @@ private:
     // Creates the shadow loader used for worker network requests.
     void initializeLoader(const WebURL&);
 
+    void didReceiveScriptLoaderResponse();
+    void onScriptLoaderFinished();
 
     static void connectTask(WebCore::ExecutionContext*, PassOwnPtr<WebMessagePortChannel>);
     // Tasks that are run on the main thread.
@@ -121,6 +130,7 @@ private:
     void workerGlobalScopeDestroyedOnMainThread();
 
     // 'shadow page' - created to proxy loading requests from the worker.
+    RefPtr<WebCore::ExecutionContext> m_loadingDocument;
     WebView* m_webView;
     WebFrame* m_mainFrame;
     bool m_askedToTerminate;
@@ -136,6 +146,14 @@ private:
     WeakPtr<WebSharedWorkerClient> m_clientWeakPtr;
 
     bool m_pauseWorkerContextOnStart;
+    bool m_attachDevToolsOnStart;
+
+    // Kept around only while main script loading is ongoing.
+    OwnPtr<Loader> m_mainScriptLoader;
+    WebURL m_url;
+    WebString m_name;
+    WebString m_contentSecurityPolicy;
+    WebContentSecurityPolicyType m_policyType;
 };
 
 } // namespace blink