| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #define WebEmbeddedWorkerImpl_h | 32 #define WebEmbeddedWorkerImpl_h |
| 33 | 33 |
| 34 #include "core/workers/WorkerLoaderProxy.h" | 34 #include "core/workers/WorkerLoaderProxy.h" |
| 35 | 35 |
| 36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 37 #include "public/web/WebContentSecurityPolicy.h" | 37 #include "public/web/WebContentSecurityPolicy.h" |
| 38 #include "public/web/WebDevToolsAgentClient.h" | 38 #include "public/web/WebDevToolsAgentClient.h" |
| 39 #include "public/web/WebEmbeddedWorker.h" | 39 #include "public/web/WebEmbeddedWorker.h" |
| 40 #include "public/web/WebEmbeddedWorkerStartData.h" | 40 #include "public/web/WebEmbeddedWorkerStartData.h" |
| 41 #include "public/web/WebFrameClient.h" | 41 #include "public/web/WebFrameClient.h" |
| 42 #include "public/web/WebWidgetClient.h" |
| 42 #include <memory> | 43 #include <memory> |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class ParentFrameTaskRunners; | 47 class ParentFrameTaskRunners; |
| 47 class ServiceWorkerGlobalScopeProxy; | 48 class ServiceWorkerGlobalScopeProxy; |
| 48 class WebLocalFrameImpl; | 49 class WebLocalFrameImpl; |
| 50 class WebFrameWidget; |
| 49 class WebServiceWorkerNetworkProvider; | 51 class WebServiceWorkerNetworkProvider; |
| 50 class WebView; | 52 class WebView; |
| 51 class WorkerInspectorProxy; | 53 class WorkerInspectorProxy; |
| 52 class WorkerScriptLoader; | 54 class WorkerScriptLoader; |
| 53 class WorkerThread; | 55 class WorkerThread; |
| 54 | 56 |
| 55 class WebEmbeddedWorkerImpl final | 57 class WebEmbeddedWorkerImpl final |
| 56 : public WebEmbeddedWorker | 58 : public WebEmbeddedWorker |
| 57 , public WebFrameClient | 59 , public WebFrameClient |
| 58 , public WebDevToolsAgentClient | 60 , public WebDevToolsAgentClient |
| 59 , private WorkerLoaderProxyProvider { | 61 , private WorkerLoaderProxyProvider |
| 62 // TODO(falken): Remove once worker doesn't do layout anymore. See https://c
rbug/538751. |
| 63 , private WebWidgetClient { |
| 60 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); | 64 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); |
| 61 public: | 65 public: |
| 62 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, std::u
nique_ptr<WebWorkerContentSettingsClientProxy>); | 66 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, std::u
nique_ptr<WebWorkerContentSettingsClientProxy>); |
| 63 ~WebEmbeddedWorkerImpl() override; | 67 ~WebEmbeddedWorkerImpl() override; |
| 64 | 68 |
| 65 // WebEmbeddedWorker overrides. | 69 // WebEmbeddedWorker overrides. |
| 66 void startWorkerContext(const WebEmbeddedWorkerStartData&) override; | 70 void startWorkerContext(const WebEmbeddedWorkerStartData&) override; |
| 67 void terminateWorkerContext() override; | 71 void terminateWorkerContext() override; |
| 68 void resumeAfterDownload() override; | 72 void resumeAfterDownload() override; |
| 69 void attachDevTools(const WebString& hostId, int sessionId) override; | 73 void attachDevTools(const WebString& hostId, int sessionId) override; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 RefPtr<WorkerScriptLoader> m_mainScriptLoader; | 114 RefPtr<WorkerScriptLoader> m_mainScriptLoader; |
| 111 | 115 |
| 112 Persistent<ParentFrameTaskRunners> m_mainThreadTaskRunners; | 116 Persistent<ParentFrameTaskRunners> m_mainThreadTaskRunners; |
| 113 | 117 |
| 114 std::unique_ptr<WorkerThread> m_workerThread; | 118 std::unique_ptr<WorkerThread> m_workerThread; |
| 115 RefPtr<WorkerLoaderProxy> m_loaderProxy; | 119 RefPtr<WorkerLoaderProxy> m_loaderProxy; |
| 116 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; | 120 Persistent<ServiceWorkerGlobalScopeProxy> m_workerGlobalScopeProxy; |
| 117 Persistent<WorkerInspectorProxy> m_workerInspectorProxy; | 121 Persistent<WorkerInspectorProxy> m_workerInspectorProxy; |
| 118 | 122 |
| 119 // 'shadow page' - created to proxy loading requests from the worker. | 123 // 'shadow page' - created to proxy loading requests from the worker. |
| 120 // Both WebView and WebFrame objects are close()'ed (where they're | 124 // WebView, WebFrameWidget and WebFrame objects are close()'ed (where |
| 121 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they | 125 // they're deref'ed) when this EmbeddedWorkerImpl is destructed, therefore |
| 122 // are guaranteed to exist while this object is around. | 126 // they are guaranteed to exist while this object is around. |
| 123 WebView* m_webView; | 127 WebView* m_webView; |
| 128 WebFrameWidget* m_webFrameWidget; |
| 124 Persistent<WebLocalFrameImpl> m_mainFrame; | 129 Persistent<WebLocalFrameImpl> m_mainFrame; |
| 125 | 130 |
| 126 bool m_loadingShadowPage; | 131 bool m_loadingShadowPage; |
| 127 bool m_askedToTerminate; | 132 bool m_askedToTerminate; |
| 128 | 133 |
| 129 enum WaitingForDebuggerState { | 134 enum WaitingForDebuggerState { |
| 130 WaitingForDebugger, | 135 WaitingForDebugger, |
| 131 NotWaitingForDebugger | 136 NotWaitingForDebugger |
| 132 }; | 137 }; |
| 133 | 138 |
| 134 enum { | 139 enum { |
| 135 DontPauseAfterDownload, | 140 DontPauseAfterDownload, |
| 136 DoPauseAfterDownload, | 141 DoPauseAfterDownload, |
| 137 IsPausedAfterDownload | 142 IsPausedAfterDownload |
| 138 } m_pauseAfterDownloadState; | 143 } m_pauseAfterDownloadState; |
| 139 | 144 |
| 140 WaitingForDebuggerState m_waitingForDebuggerState; | 145 WaitingForDebuggerState m_waitingForDebuggerState; |
| 141 }; | 146 }; |
| 142 | 147 |
| 143 } // namespace blink | 148 } // namespace blink |
| 144 | 149 |
| 145 #endif // WebEmbeddedWorkerImpl_h | 150 #endif // WebEmbeddedWorkerImpl_h |
| OLD | NEW |