Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / web / WebEmbeddedWorkerImpl.h
index 71c6662..d4b7ce9 100644 (file)
 #ifndef WebEmbeddedWorkerImpl_h
 #define WebEmbeddedWorkerImpl_h
 
-#include "WebContentSecurityPolicy.h"
-#include "WebEmbeddedWorker.h"
-#include "WebEmbeddedWorkerStartData.h"
-#include "WebFrameClient.h"
-
-namespace WebCore {
-class WorkerScriptLoader;
-class WorkerThread;
-}
+#include "public/web/WebContentSecurityPolicy.h"
+#include "public/web/WebEmbeddedWorker.h"
+#include "public/web/WebEmbeddedWorkerStartData.h"
+#include "public/web/WebFrameClient.h"
 
 namespace blink {
 
 class ServiceWorkerGlobalScopeProxy;
 class WebServiceWorkerNetworkProvider;
 class WebView;
+class WorkerScriptLoader;
+class WorkerThread;
 
-class WebEmbeddedWorkerImpl FINAL :
-    public WebEmbeddedWorker,
-    public WebFrameClient {
+class WebEmbeddedWorkerImpl FINAL
+    : public WebEmbeddedWorker
+    public WebFrameClient {
     WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl);
 public:
     WebEmbeddedWorkerImpl(
@@ -57,9 +54,20 @@ public:
         PassOwnPtr<WebWorkerPermissionClientProxy>);
     virtual ~WebEmbeddedWorkerImpl();
 
+    // Terminate all WebEmbeddedWorkerImpl for testing purposes.
+    // Note that this only schedules termination and
+    // does not synchronously wait for it to complete.
+    static void terminateAll();
+
     // WebEmbeddedWorker overrides.
     virtual void startWorkerContext(const WebEmbeddedWorkerStartData&) OVERRIDE;
+    virtual void resumeAfterDownload() OVERRIDE;
     virtual void terminateWorkerContext() OVERRIDE;
+    virtual void resumeWorkerContext() OVERRIDE;
+    virtual void attachDevTools() OVERRIDE;
+    virtual void reattachDevTools(const WebString& savedState) OVERRIDE;
+    virtual void detachDevTools() OVERRIDE;
+    virtual void dispatchDevToolsMessage(const WebString&) OVERRIDE;
 
 private:
     class Loader;
@@ -69,17 +77,19 @@ private:
 
     // WebFrameClient overrides.
     virtual void willSendRequest(
-        WebFrame*, unsigned identifier, WebURLRequest&,
+        WebLocalFrame*, unsigned identifier, WebURLRequest&,
         const WebURLResponse& redirectResponse) OVERRIDE;
-    virtual void didFinishDocumentLoad(WebFrame*) OVERRIDE;
+    virtual void didFinishDocumentLoad(WebLocalFrame*) OVERRIDE;
 
     void onScriptLoaderFinished();
+    void startWorkerThread();
 
     WebEmbeddedWorkerStartData m_workerStartData;
 
-    // These are kept until startWorkerContext is called, and then passed on
-    // to WorkerContext.
     OwnPtr<WebServiceWorkerContextClient> m_workerContextClient;
+
+    // This is kept until startWorkerContext is called, and then passed on
+    // to WorkerContext.
     OwnPtr<WebWorkerPermissionClientProxy> m_permissionClient;
 
     // We retain ownership of this one which is for use on the
@@ -89,7 +99,7 @@ private:
     // Kept around only while main script loading is ongoing.
     OwnPtr<Loader> m_mainScriptLoader;
 
-    RefPtr<WebCore::WorkerThread> m_workerThread;
+    RefPtr<WorkerThread> m_workerThread;
     OwnPtr<LoaderProxy> m_loaderProxy;
     OwnPtr<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy;
 
@@ -101,6 +111,12 @@ private:
     WebFrame* m_mainFrame;
 
     bool m_askedToTerminate;
+
+    enum {
+        DontPauseAfterDownload,
+        DoPauseAfterDownload,
+        IsPausedAfterDownload
+    } m_pauseAfterDownloadState;
 };
 
 } // namespace blink