| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 17 matching lines...) Expand all Loading... |
| 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 WebSharedWorkerImpl_h | 31 #ifndef WebSharedWorkerImpl_h |
| 32 #define WebSharedWorkerImpl_h | 32 #define WebSharedWorkerImpl_h |
| 33 | 33 |
| 34 #include "public/web/WebSharedWorker.h" | 34 #include "public/web/WebSharedWorker.h" |
| 35 | 35 |
| 36 #include <memory> | 36 #include <memory> |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/workers/WorkerLoaderProxy.h" | |
| 39 #include "core/workers/WorkerThread.h" | 38 #include "core/workers/WorkerThread.h" |
| 40 #include "platform/wtf/RefPtr.h" | 39 #include "platform/wtf/RefPtr.h" |
| 41 #include "public/platform/WebAddressSpace.h" | 40 #include "public/platform/WebAddressSpace.h" |
| 42 #include "public/platform/WebContentSecurityPolicy.h" | 41 #include "public/platform/WebContentSecurityPolicy.h" |
| 43 #include "public/web/WebDevToolsAgentClient.h" | 42 #include "public/web/WebDevToolsAgentClient.h" |
| 44 #include "public/web/WebFrameClient.h" | 43 #include "public/web/WebFrameClient.h" |
| 45 #include "public/web/WebSharedWorkerClient.h" | 44 #include "public/web/WebSharedWorkerClient.h" |
| 46 #include "web/WebSharedWorkerReportingProxyImpl.h" | 45 #include "web/WebSharedWorkerReportingProxyImpl.h" |
| 47 | 46 |
| 48 namespace blink { | 47 namespace blink { |
| 49 | 48 |
| 50 class WebApplicationCacheHost; | 49 class WebApplicationCacheHost; |
| 51 class WebApplicationCacheHostClient; | 50 class WebApplicationCacheHostClient; |
| 52 class WebLocalFrameImpl; | 51 class WebLocalFrameImpl; |
| 53 class WebServiceWorkerNetworkProvider; | 52 class WebServiceWorkerNetworkProvider; |
| 54 class WebSharedWorkerClient; | 53 class WebSharedWorkerClient; |
| 55 class WebString; | 54 class WebString; |
| 56 class WebURL; | 55 class WebURL; |
| 57 class WebView; | 56 class WebView; |
| 58 class WorkerInspectorProxy; | 57 class WorkerInspectorProxy; |
| 59 class WorkerScriptLoader; | 58 class WorkerScriptLoader; |
| 60 | 59 |
| 61 // This class is used by the worker process code to talk to the SharedWorker | 60 // This class is used by the worker process code to talk to the SharedWorker |
| 62 // implementation. This is basically accessed on the main thread, but some | 61 // implementation. This is basically accessed on the main thread, but some |
| 63 // methods must be called from a worker thread. Such methods are suffixed with | 62 // methods must be called from a worker thread. Such methods are suffixed with |
| 64 // *OnWorkerThread or have header comments. | 63 // *OnWorkerThread or have header comments. |
| 65 class WebSharedWorkerImpl final : public WebFrameClient, | 64 class WebSharedWorkerImpl final : public WebFrameClient, |
| 66 public WebSharedWorker, | 65 public WebSharedWorker, |
| 67 public WebDevToolsAgentClient, | 66 public WebDevToolsAgentClient { |
| 68 private WorkerLoaderProxyProvider { | |
| 69 public: | 67 public: |
| 70 explicit WebSharedWorkerImpl(WebSharedWorkerClient*); | 68 explicit WebSharedWorkerImpl(WebSharedWorkerClient*); |
| 71 | 69 |
| 72 // WebFrameClient methods to support resource loading thru the 'shadow page'. | 70 // WebFrameClient methods to support resource loading thru the 'shadow page'. |
| 73 WebApplicationCacheHost* CreateApplicationCacheHost( | 71 WebApplicationCacheHost* CreateApplicationCacheHost( |
| 74 WebApplicationCacheHostClient*) override; | 72 WebApplicationCacheHostClient*) override; |
| 75 void DidFinishDocumentLoad(WebLocalFrame*) override; | 73 void DidFinishDocumentLoad(WebLocalFrame*) override; |
| 76 | 74 |
| 77 // WebDevToolsAgentClient overrides. | 75 // WebDevToolsAgentClient overrides. |
| 78 void SendProtocolMessage(int session_id, | 76 void SendProtocolMessage(int session_id, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 117 |
| 120 // Creates the shadow loader used for worker network requests. | 118 // Creates the shadow loader used for worker network requests. |
| 121 void InitializeLoader(); | 119 void InitializeLoader(); |
| 122 | 120 |
| 123 void LoadShadowPage(); | 121 void LoadShadowPage(); |
| 124 void DidReceiveScriptLoaderResponse(); | 122 void DidReceiveScriptLoaderResponse(); |
| 125 void OnScriptLoaderFinished(); | 123 void OnScriptLoaderFinished(); |
| 126 | 124 |
| 127 void ConnectTaskOnWorkerThread(std::unique_ptr<WebMessagePortChannel>); | 125 void ConnectTaskOnWorkerThread(std::unique_ptr<WebMessagePortChannel>); |
| 128 | 126 |
| 129 // WorkerLoaderProxyProvider | |
| 130 ThreadableLoadingContext* GetThreadableLoadingContext() override; | |
| 131 | |
| 132 // 'shadow page' - created to proxy loading requests from the worker. | 127 // 'shadow page' - created to proxy loading requests from the worker. |
| 133 // Will be accessed by worker thread when posting tasks. | 128 // Will be accessed by worker thread when posting tasks. |
| 134 Persistent<ExecutionContext> loading_document_; | 129 Persistent<ExecutionContext> loading_document_; |
| 135 Persistent<ThreadableLoadingContext> loading_context_; | 130 Persistent<ThreadableLoadingContext> loading_context_; |
| 136 WebView* web_view_; | 131 WebView* web_view_; |
| 137 Persistent<WebLocalFrameImpl> main_frame_; | 132 Persistent<WebLocalFrameImpl> main_frame_; |
| 138 bool asked_to_terminate_; | 133 bool asked_to_terminate_; |
| 139 | 134 |
| 140 std::unique_ptr<WebServiceWorkerNetworkProvider> network_provider_; | 135 std::unique_ptr<WebServiceWorkerNetworkProvider> network_provider_; |
| 141 | 136 |
| 142 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; | 137 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; |
| 143 | 138 |
| 144 Persistent<WebSharedWorkerReportingProxyImpl> reporting_proxy_; | 139 Persistent<WebSharedWorkerReportingProxyImpl> reporting_proxy_; |
| 145 std::unique_ptr<WorkerThread> worker_thread_; | 140 std::unique_ptr<WorkerThread> worker_thread_; |
| 146 | 141 |
| 147 WebSharedWorkerClient* client_; | 142 WebSharedWorkerClient* client_; |
| 148 | 143 |
| 149 bool pause_worker_context_on_start_; | 144 bool pause_worker_context_on_start_; |
| 150 bool is_paused_on_start_; | 145 bool is_paused_on_start_; |
| 151 | 146 |
| 152 // Kept around only while main script loading is ongoing. | 147 // Kept around only while main script loading is ongoing. |
| 153 RefPtr<WorkerScriptLoader> main_script_loader_; | 148 RefPtr<WorkerScriptLoader> main_script_loader_; |
| 154 | 149 |
| 155 RefPtr<WorkerLoaderProxy> loader_proxy_; | |
| 156 | |
| 157 WebURL url_; | 150 WebURL url_; |
| 158 WebString name_; | 151 WebString name_; |
| 159 WebAddressSpace creation_address_space_; | 152 WebAddressSpace creation_address_space_; |
| 160 }; | 153 }; |
| 161 | 154 |
| 162 } // namespace blink | 155 } // namespace blink |
| 163 | 156 |
| 164 #endif // WebSharedWorkerImpl_h | 157 #endif // WebSharedWorkerImpl_h |
| OLD | NEW |