Chromium Code Reviews| Index: Source/web/WebEmbeddedWorkerImpl.h |
| diff --git a/public/web/WebEmbeddedWorker.h b/Source/web/WebEmbeddedWorkerImpl.h |
| similarity index 50% |
| copy from public/web/WebEmbeddedWorker.h |
| copy to Source/web/WebEmbeddedWorkerImpl.h |
| index 707ab09968699cb1f4884f715cfc68e9e9a657c4..dae20f0d78fcf0ab368d0b294871fc054894ba01 100644 |
| --- a/public/web/WebEmbeddedWorker.h |
| +++ b/Source/web/WebEmbeddedWorkerImpl.h |
| @@ -28,35 +28,67 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef WebEmbeddedWorker_h |
| -#define WebEmbeddedWorker_h |
| +#ifndef WebEmbeddedWorkerImpl_h |
| +#define WebEmbeddedWorkerImpl_h |
| -#include "public/platform/WebCommon.h" |
| +#include "WebContentSecurityPolicy.h" |
| +#include "WebEmbeddedWorker.h" |
| +#include "WebEmbeddedWorkerStartData.h" |
| +#include "WebFrameClient.h" |
| +#include "core/frame/ContentSecurityPolicyResponseHeaders.h" |
| + |
| +namespace WebCore { |
| +class ContentSecurityPolicyResponseHeaders; |
| +class WorkerScriptLoader; |
| +class WorkerThread; |
| +} |
| namespace blink { |
| -class WebServiceWorkerContextClient; |
| -struct WebEmbeddedWorkerStartData; |
| +class WebView; |
| -// An interface to start and terminate an embedded worker. |
| -// All methods of this class must be called on the main thread. |
| -class WebEmbeddedWorker { |
| +class WebEmbeddedWorkerImpl : |
| + public WebEmbeddedWorker, |
| + public WebFrameClient { |
| public: |
| - // Invoked on the main thread to instantiate a WebEmbeddedWorker. |
| - // The given WebWorkerContextClient and WebWorkerPermissionClientProxy are |
| - // going to be passed on to the worker thread and is held by a newly |
| - // created WorkerGlobalScope. |
| - BLINK_EXPORT static WebEmbeddedWorker* create( |
| - WebServiceWorkerContextClient*, |
| - WebWorkerPermissionClientProxy*); |
| - |
| - virtual ~WebEmbeddedWorker() { } |
| - |
| - // Starts and terminates WorkerThread and WorkerGlobalScope. |
| - virtual void startWorkerContext(const WebEmbeddedWorkerStartData&) = 0; |
| - virtual void terminateWorkerContext() = 0; |
| + WebEmbeddedWorkerImpl( |
| + PassOwnPtr<WebServiceWorkerContextClient>, |
| + PassOwnPtr<WebWorkerPermissionClientProxy>); |
| + virtual ~WebEmbeddedWorkerImpl(); |
| + |
| + // WebEmbeddedWorker overrides. |
| + virtual void startWorkerContext(const WebEmbeddedWorkerStartData&) OVERRIDE; |
| + virtual void terminateWorkerContext() OVERRIDE; |
| + |
| +private: |
| + class Loader; |
| + |
| + void prepareShadowPageForLoader(); |
| + void onScriptLoaderFinished(); |
| + |
| + // WebFrameClient overrides, for 'shadow page' loading. |
| + virtual void didCreateDataSource(WebFrame*, WebDataSource*) OVERRIDE; |
| + |
| + WebEmbeddedWorkerStartData m_workerStartData; |
| + |
| + // These are kept until startWorkerContext is called, and then passed on |
| + // to WorkerContext. |
| + OwnPtr<WebServiceWorkerContextClient> m_workerContextClient; |
| + OwnPtr<WebWorkerPermissionClientProxy> m_permissionClient; |
| + |
| + // Kept around only while main script loading is ongoing. |
| + OwnPtr<Loader> m_mainScriptLoader; |
| + |
| + RefPtr<WebCore::WorkerThread> m_workerThread; |
| + |
| + // 'shadow page' - created to proxy loading requests from the worker. |
| + WebView* m_webView; |
| + WebFrame* m_mainFrame; |
|
abarth-chromium
2013/11/25 01:45:37
What manages the lifetime of these raw pointers?
kinuko
2013/11/25 03:31:48
I added comment about the ownership/lifetime seman
|
| + RefPtr<WebCore::ExecutionContext> m_loadingDocument; |
| + |
| + bool m_askedToTerminate; |
| }; |
| } // namespace blink |
| -#endif // WebEmbeddedWorker_h |
| +#endif // WebEmbeddedWorkerImpl_h |