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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class WebApplicationCacheHost; | 50 class WebApplicationCacheHost; |
51 class WebApplicationCacheHostClient; | 51 class WebApplicationCacheHostClient; |
52 class WebLocalFrameImpl; | 52 class WebLocalFrameImpl; |
53 class WebServiceWorkerNetworkProvider; | 53 class WebServiceWorkerNetworkProvider; |
54 class WebSharedWorkerClient; | 54 class WebSharedWorkerClient; |
55 class WebString; | 55 class WebString; |
56 class WebURL; | 56 class WebURL; |
57 class WebView; | 57 class WebView; |
58 class WorkerInspectorProxy; | 58 class WorkerInspectorProxy; |
59 class WorkerScriptLoader; | 59 class WorkerScriptLoader; |
| 60 class WorkerShadowFetchContext; |
60 | 61 |
61 // This class is used by the worker process code to talk to the SharedWorker | 62 // 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 | 63 // 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 | 64 // methods must be called from a worker thread. Such methods are suffixed with |
64 // *OnWorkerThread or have header comments. | 65 // *OnWorkerThread or have header comments. |
65 class WebSharedWorkerImpl final : public WebFrameClient, | 66 class WebSharedWorkerImpl final : public WebFrameClient, |
66 public WebSharedWorker, | 67 public WebSharedWorker, |
67 public WebDevToolsAgentClient, | 68 public WebDevToolsAgentClient, |
68 private WorkerLoaderProxyProvider { | 69 private WorkerLoaderProxyProvider { |
69 public: | 70 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void DidTerminateWorkerThread(); | 111 void DidTerminateWorkerThread(); |
111 | 112 |
112 private: | 113 private: |
113 ~WebSharedWorkerImpl() override; | 114 ~WebSharedWorkerImpl() override; |
114 | 115 |
115 WorkerThread* GetWorkerThread() { return worker_thread_.get(); } | 116 WorkerThread* GetWorkerThread() { return worker_thread_.get(); } |
116 | 117 |
117 // Shuts down the worker thread. | 118 // Shuts down the worker thread. |
118 void TerminateWorkerThread(); | 119 void TerminateWorkerThread(); |
119 | 120 |
| 121 void InitializeShadowFetchContext(); |
| 122 |
120 // Creates the shadow loader used for worker network requests. | 123 // Creates the shadow loader used for worker network requests. |
121 void InitializeLoader(); | 124 void InitializeLoader(); |
122 | 125 |
123 void LoadShadowPage(); | 126 void LoadShadowPage(); |
124 void DidReceiveScriptLoaderResponse(); | 127 void DidReceiveScriptLoaderResponse(); |
125 void OnScriptLoaderFinished(); | 128 void OnScriptLoaderFinished(); |
126 | 129 |
127 void ConnectTaskOnWorkerThread(std::unique_ptr<WebMessagePortChannel>); | 130 void ConnectTaskOnWorkerThread(std::unique_ptr<WebMessagePortChannel>); |
128 | 131 |
129 // WorkerLoaderProxyProvider | 132 // WorkerLoaderProxyProvider |
130 ThreadableLoadingContext* GetThreadableLoadingContext() override; | 133 ThreadableLoadingContext* GetThreadableLoadingContext() override; |
131 | 134 |
132 // 'shadow page' - created to proxy loading requests from the worker. | 135 // 'shadow page' - created to proxy loading requests from the worker. |
133 // Will be accessed by worker thread when posting tasks. | 136 // Will be accessed by worker thread when posting tasks. |
134 Persistent<ExecutionContext> loading_document_; | 137 Persistent<ExecutionContext> loading_document_; |
135 Persistent<ThreadableLoadingContext> loading_context_; | 138 Persistent<ThreadableLoadingContext> loading_context_; |
136 WebView* web_view_; | 139 WebView* web_view_; |
137 Persistent<WebLocalFrameImpl> main_frame_; | 140 Persistent<WebLocalFrameImpl> main_frame_; |
138 bool asked_to_terminate_; | 141 bool asked_to_terminate_; |
139 | 142 |
140 std::unique_ptr<WebServiceWorkerNetworkProvider> network_provider_; | 143 std::unique_ptr<WebServiceWorkerNetworkProvider> network_provider_; |
141 | 144 |
142 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; | 145 Persistent<WorkerInspectorProxy> worker_inspector_proxy_; |
143 | 146 |
144 Persistent<WebSharedWorkerReportingProxyImpl> reporting_proxy_; | 147 Persistent<WebSharedWorkerReportingProxyImpl> reporting_proxy_; |
145 std::unique_ptr<WorkerThread> worker_thread_; | 148 std::unique_ptr<WorkerThread> worker_thread_; |
146 | 149 |
| 150 Persistent<WorkerShadowFetchContext> shadow_fetch_context_; |
| 151 |
147 WebSharedWorkerClient* client_; | 152 WebSharedWorkerClient* client_; |
148 | 153 |
149 bool pause_worker_context_on_start_; | 154 bool pause_worker_context_on_start_; |
150 bool is_paused_on_start_; | 155 bool is_paused_on_start_; |
151 | 156 |
152 // Kept around only while main script loading is ongoing. | 157 // Kept around only while main script loading is ongoing. |
153 RefPtr<WorkerScriptLoader> main_script_loader_; | 158 RefPtr<WorkerScriptLoader> main_script_loader_; |
154 | 159 |
155 RefPtr<WorkerLoaderProxy> loader_proxy_; | 160 RefPtr<WorkerLoaderProxy> loader_proxy_; |
156 | 161 |
157 WebURL url_; | 162 WebURL url_; |
158 WebString name_; | 163 WebString name_; |
159 WebAddressSpace creation_address_space_; | 164 WebAddressSpace creation_address_space_; |
160 }; | 165 }; |
161 | 166 |
162 } // namespace blink | 167 } // namespace blink |
163 | 168 |
164 #endif // WebSharedWorkerImpl_h | 169 #endif // WebSharedWorkerImpl_h |
OLD | NEW |