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/Platform.h" | 36 #include "public/platform/Platform.h" |
39 #include "public/platform/WebContentSecurityPolicy.h" | 37 #include "public/platform/WebContentSecurityPolicy.h" |
40 #include "public/web/WebDevToolsAgentClient.h" | 38 #include "public/web/WebDevToolsAgentClient.h" |
41 #include "public/web/WebEmbeddedWorker.h" | 39 #include "public/web/WebEmbeddedWorker.h" |
42 #include "public/web/WebEmbeddedWorkerStartData.h" | 40 #include "public/web/WebEmbeddedWorkerStartData.h" |
43 #include "public/web/WebFrameClient.h" | 41 #include "public/web/WebFrameClient.h" |
44 | 42 |
45 namespace blink { | 43 namespace blink { |
46 | 44 |
47 class ThreadableLoadingContext; | 45 class ThreadableLoadingContext; |
48 class ServiceWorkerGlobalScopeProxy; | 46 class ServiceWorkerGlobalScopeProxy; |
49 class WebLocalFrameBase; | 47 class WebLocalFrameBase; |
50 class WebView; | 48 class WebView; |
51 class WorkerInspectorProxy; | 49 class WorkerInspectorProxy; |
52 class WorkerScriptLoader; | 50 class WorkerScriptLoader; |
53 class WorkerThread; | 51 class WorkerThread; |
54 | 52 |
55 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker, | 53 class WebEmbeddedWorkerImpl final : public WebEmbeddedWorker, |
56 public WebFrameClient, | 54 public WebFrameClient, |
57 public WebDevToolsAgentClient, | 55 public WebDevToolsAgentClient { |
58 private WorkerLoaderProxyProvider { | |
59 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); | 56 WTF_MAKE_NONCOPYABLE(WebEmbeddedWorkerImpl); |
60 | 57 |
61 public: | 58 public: |
62 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, | 59 WebEmbeddedWorkerImpl(std::unique_ptr<WebServiceWorkerContextClient>, |
63 std::unique_ptr<WebWorkerContentSettingsClientProxy>); | 60 std::unique_ptr<WebWorkerContentSettingsClientProxy>); |
64 ~WebEmbeddedWorkerImpl() override; | 61 ~WebEmbeddedWorkerImpl() override; |
65 | 62 |
66 // WebEmbeddedWorker overrides. | 63 // WebEmbeddedWorker overrides. |
67 void StartWorkerContext(const WebEmbeddedWorkerStartData&) override; | 64 void StartWorkerContext(const WebEmbeddedWorkerStartData&) override; |
68 void TerminateWorkerContext() override; | 65 void TerminateWorkerContext() override; |
(...skipping 28 matching lines...) Expand all Loading... |
97 int call_id, | 94 int call_id, |
98 const WebString&, | 95 const WebString&, |
99 const WebString&) override; | 96 const WebString&) override; |
100 void ResumeStartup() override; | 97 void ResumeStartup() override; |
101 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() | 98 WebDevToolsAgentClient::WebKitClientMessageLoop* CreateClientMessageLoop() |
102 override; | 99 override; |
103 | 100 |
104 void OnScriptLoaderFinished(); | 101 void OnScriptLoaderFinished(); |
105 void StartWorkerThread(); | 102 void StartWorkerThread(); |
106 | 103 |
107 // WorkerLoaderProxyProvider | |
108 ThreadableLoadingContext* GetThreadableLoadingContext() override; | |
109 | |
110 WebEmbeddedWorkerStartData worker_start_data_; | 104 WebEmbeddedWorkerStartData worker_start_data_; |
111 | 105 |
112 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; | 106 std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; |
113 | 107 |
114 // This is kept until startWorkerContext is called, and then passed on | 108 // This is kept until startWorkerContext is called, and then passed on |
115 // to WorkerContext. | 109 // to WorkerContext. |
116 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_; | 110 std::unique_ptr<WebWorkerContentSettingsClientProxy> content_settings_client_; |
117 | 111 |
118 // Kept around only while main script loading is ongoing. | 112 // Kept around only while main script loading is ongoing. |
119 RefPtr<WorkerScriptLoader> main_script_loader_; | 113 RefPtr<WorkerScriptLoader> main_script_loader_; |
120 | 114 |
121 std::unique_ptr<WorkerThread> worker_thread_; | 115 std::unique_ptr<WorkerThread> worker_thread_; |
122 RefPtr<WorkerLoaderProxy> loader_proxy_; | |
123 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_; | 116 Persistent<ServiceWorkerGlobalScopeProxy> worker_global_scope_proxy_; |
124 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; | 117 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; |
125 | 118 |
126 // 'shadow page' - created to proxy loading requests from the worker. | 119 // 'shadow page' - created to proxy loading requests from the worker. |
127 // Both WebView and WebFrame objects are close()'ed (where they're | 120 // Both WebView and WebFrame objects are close()'ed (where they're |
128 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they | 121 // deref'ed) when this EmbeddedWorkerImpl is destructed, therefore they |
129 // are guaranteed to exist while this object is around. | 122 // are guaranteed to exist while this object is around. |
130 WebView* web_view_; | 123 WebView* web_view_; |
131 | 124 |
132 Persistent<WebLocalFrameBase> main_frame_; | 125 Persistent<WebLocalFrameBase> main_frame_; |
133 Persistent<ThreadableLoadingContext> loading_context_; | 126 Persistent<ThreadableLoadingContext> loading_context_; |
134 | 127 |
135 bool loading_shadow_page_; | 128 bool loading_shadow_page_; |
136 bool asked_to_terminate_; | 129 bool asked_to_terminate_; |
137 | 130 |
138 enum WaitingForDebuggerState { kWaitingForDebugger, kNotWaitingForDebugger }; | 131 enum WaitingForDebuggerState { kWaitingForDebugger, kNotWaitingForDebugger }; |
139 | 132 |
140 enum { | 133 enum { |
141 kDontPauseAfterDownload, | 134 kDontPauseAfterDownload, |
142 kDoPauseAfterDownload, | 135 kDoPauseAfterDownload, |
143 kIsPausedAfterDownload | 136 kIsPausedAfterDownload |
144 } pause_after_download_state_; | 137 } pause_after_download_state_; |
145 | 138 |
146 WaitingForDebuggerState waiting_for_debugger_state_; | 139 WaitingForDebuggerState waiting_for_debugger_state_; |
147 }; | 140 }; |
148 | 141 |
149 } // namespace blink | 142 } // namespace blink |
150 | 143 |
151 #endif // WebEmbeddedWorkerImpl_h | 144 #endif // WebEmbeddedWorkerImpl_h |
OLD | NEW |