| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebEmbeddedWorkerImpl_h | 31 #ifndef WebEmbeddedWorkerImpl_h |
| 32 #define WebEmbeddedWorkerImpl_h | 32 #define WebEmbeddedWorkerImpl_h |
| 33 | 33 |
| 34 #include "core/workers/WorkerLoaderProxy.h" | |
| 35 | |
| 36 #include <memory> | 34 #include <memory> |
| 37 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 38 #include "public/platform/WebContentSecurityPolicy.h" | 36 #include "public/platform/WebContentSecurityPolicy.h" |
| 39 #include "public/web/WebDevToolsAgentClient.h" | 37 #include "public/web/WebDevToolsAgentClient.h" |
| 40 #include "public/web/WebEmbeddedWorker.h" | 38 #include "public/web/WebEmbeddedWorker.h" |
| 41 #include "public/web/WebEmbeddedWorkerStartData.h" | 39 #include "public/web/WebEmbeddedWorkerStartData.h" |
| 42 #include "public/web/WebFrameClient.h" | 40 #include "public/web/WebFrameClient.h" |
| 43 | 41 |
| 44 namespace blink { | 42 namespace blink { |
| 45 | 43 |
| 46 class ThreadableLoadingContext; | 44 class ThreadableLoadingContext; |
| 47 class ServiceWorkerGlobalScopeProxy; | 45 class ServiceWorkerGlobalScopeProxy; |
| 48 class WebLocalFrameImpl; | 46 class WebLocalFrameImpl; |
| 49 class WebView; | 47 class WebView; |
| 50 class WorkerInspectorProxy; | 48 class WorkerInspectorProxy; |
| 51 class WorkerScriptLoader; | 49 class WorkerScriptLoader; |
| 52 class WorkerThread; | 50 class WorkerThread; |
| 53 | 51 |
| 54 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker, | 52 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker, |
| 55 public WebFrameClient, | 53 public WebFrameClient, |
| 56 public WebDevToolsAgentClient, | 54 public WebDevToolsAgentClient { |
| 57 private WorkerLoaderProxyProvider { | |
| 58 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); | 55 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); |
| 59 | 56 |
| 60 public: | 57 public: |
| 61 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, | 58 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, |
| 62 std::unique_ptr<WebWorkerContentSettingsClientProxy>); | 59 std::unique_ptr<WebWorkerContentSettingsClientProxy>); |
| 63 ~WebEmbeddedWorkerImpl() override; | 60 ~WebEmbeddedWorkerImpl() override; |
| 64 | 61 |
| 65 // WebEmbeddedWorker overrides. | 62 // WebEmbeddedWorker overrides. |
| 66 void StartWorkerContext(const WebEmbeddedWorkerStartData&) override; | 63 void StartWorkerContext(const WebEmbeddedWorkerStartData&) override; |
| 67 void TerminateWorkerContext() override; | 64 void TerminateWorkerContext() override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 91 int call_id, | 88 int call_id, |
| 92 const WebString&, | 89 const WebString&, |
| 93 const WebString&) override; | 90 const WebString&) override; |
| 94 void ResumeStartup() override; | 91 void ResumeStartup() override; |
| 95 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() | 92 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() |
| 96 override; | 93 override; |
| 97 | 94 |
| 98 void OnScriptLoaderFinished(); | 95 void OnScriptLoaderFinished(); |
| 99 void StartWorkerThread(); | 96 void StartWorkerThread(); |
| 100 | 97 |
| 101 // WorkerLoaderProxyProvider | |
| 102 ThreadableLoadingContext* GetThreadableLoadingContext() override; | |
| 103 | |
| 104 WebEmbeddedWorkerStartData worker_start_data_; | 98 WebEmbeddedWorkerStartData worker_start_data_; |
| 105 | 99 |
| 106 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; | 100 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; |
| 107 | 101 |
| 108 // This is kept until startWorkerContext is called, and then passed on | 102 // This is kept until startWorkerContext is called, and then passed on |
| 109 // to WorkerContext. | 103 // to WorkerContext. |
| 110 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_; | 104 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_; |
| 111 | 105 |
| 112 // Kept around only while main script loading is ongoing. | 106 // Kept around only while main script loading is ongoing. |
| 113 RefPtr<WorkerScriptLoader> main_script_loader_; | 107 RefPtr<WorkerScriptLoader> main_script_loader_; |
| 114 | 108 |
| 115 std::unique_ptr<WorkerThread> worker_thread_; | 109 std::unique_ptr<WorkerThread> worker_thread_; |
| 116 RefPtr<WorkerLoaderProxy> loader_proxy_; | |
| 117 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_; | 110 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_; |
| 118 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; | 111 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; |
| 119 | 112 |
| 120 // 'shadow page' - created to proxy loading requests from the worker. | 113 // 'shadow page' - created to proxy loading requests from the worker. |
| 121 // Both WebView and WebFrame objects are close()'ed (where they're | 114 // Both WebView and WebFrame objects are close()'ed (where they're |
| 122 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they | 115 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they |
| 123 // are guaranteed to exist while this object is around. | 116 // are guaranteed to exist while this object is around. |
| 124 WebView* web_view_; | 117 WebView* web_view_; |
| 125 | 118 |
| 126 Persistent<WebLocalFrameImpl> main_frame_; | 119 Persistent<WebLocalFrameImpl> main_frame_; |
| 127 Persistent<ThreadableLoadingContext> loading_context_; | 120 Persistent<ThreadableLoadingContext> loading_context_; |
| 128 | 121 |
| 129 bool loading_shadow_page_; | 122 bool loading_shadow_page_; |
| 130 bool asked_to_terminate_; | 123 bool asked_to_terminate_; |
| 131 | 124 |
| 132 enum WaitingForDebuggerState { kWaitingForDebugger, kNotWaitingForDebugger }; | 125 enum WaitingForDebuggerState { kWaitingForDebugger, kNotWaitingForDebugger }; |
| 133 | 126 |
| 134 enum { | 127 enum { |
| 135 kDontPauseAfterDownload, | 128 kDontPauseAfterDownload, |
| 136 kDoPauseAfterDownload, | 129 kDoPauseAfterDownload, |
| 137 kIsPausedAfterDownload | 130 kIsPausedAfterDownload |
| 138 } pause_after_download_state_; | 131 } pause_after_download_state_; |
| 139 | 132 |
| 140 WaitingForDebuggerState waiting_for_debugger_state_; | 133 WaitingForDebuggerState waiting_for_debugger_state_; |
| 141 }; | 134 }; |
| 142 | 135 |
| 143 } // namespace blink | 136 } // namespace blink |
| 144 | 137 |
| 145 #endif // WebEmbeddedWorkerImpl_h | 138 #endif // WebEmbeddedWorkerImpl_h |
| OLD | NEW |