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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 USING_PRE_FINALIZER(MainThreadLoaderHolder, cancel); | 139 USING_PRE_FINALIZER(MainThreadLoaderHolder, cancel); |
140 | 140 |
141 public: | 141 public: |
142 static void createAndStart(WorkerThreadableLoader*, | 142 static void createAndStart(WorkerThreadableLoader*, |
143 PassRefPtr<WorkerLoaderProxy>, | 143 PassRefPtr<WorkerLoaderProxy>, |
144 WorkerThreadLifecycleContext*, | 144 WorkerThreadLifecycleContext*, |
145 std::unique_ptr<CrossThreadResourceRequestData>, | 145 std::unique_ptr<CrossThreadResourceRequestData>, |
146 const ThreadableLoaderOptions&, | 146 const ThreadableLoaderOptions&, |
147 const ResourceLoaderOptions&, | 147 const ResourceLoaderOptions&, |
148 PassRefPtr<WaitableEventWithTasks>, | 148 PassRefPtr<WaitableEventWithTasks>, |
| 149 double postTaskTime, |
| 150 bool isServiceWorker, |
149 ExecutionContext*); | 151 ExecutionContext*); |
150 ~MainThreadLoaderHolder() override; | 152 ~MainThreadLoaderHolder() override; |
151 | 153 |
152 void overrideTimeout(unsigned long timeoutMillisecond); | 154 void overrideTimeout(unsigned long timeoutMillisecond); |
153 void cancel(); | 155 void cancel(); |
154 | 156 |
155 void didSendData(unsigned long long bytesSent, | 157 void didSendData(unsigned long long bytesSent, |
156 unsigned long long totalBytesToBeSent) override; | 158 unsigned long long totalBytesToBeSent) override; |
157 void didReceiveRedirectTo(const KURL&) override; | 159 void didReceiveRedirectTo(const KURL&) override; |
158 void didReceiveResponse(unsigned long identifier, | 160 void didReceiveResponse(unsigned long identifier, |
(...skipping 14 matching lines...) Expand all Loading... |
173 | 175 |
174 private: | 176 private: |
175 MainThreadLoaderHolder(TaskForwarder*, WorkerThreadLifecycleContext*); | 177 MainThreadLoaderHolder(TaskForwarder*, WorkerThreadLifecycleContext*); |
176 void start(Document&, | 178 void start(Document&, |
177 std::unique_ptr<CrossThreadResourceRequestData>, | 179 std::unique_ptr<CrossThreadResourceRequestData>, |
178 const ThreadableLoaderOptions&, | 180 const ThreadableLoaderOptions&, |
179 const ResourceLoaderOptions&); | 181 const ResourceLoaderOptions&); |
180 | 182 |
181 Member<TaskForwarder> m_forwarder; | 183 Member<TaskForwarder> m_forwarder; |
182 Member<ThreadableLoader> m_mainThreadLoader; | 184 Member<ThreadableLoader> m_mainThreadLoader; |
| 185 bool m_isServiceWorker; |
183 | 186 |
184 // |*m_workerLoader| lives in the worker thread. | 187 // |*m_workerLoader| lives in the worker thread. |
185 CrossThreadWeakPersistent<WorkerThreadableLoader> m_workerLoader; | 188 CrossThreadWeakPersistent<WorkerThreadableLoader> m_workerLoader; |
186 }; | 189 }; |
187 | 190 |
188 WorkerThreadableLoader(WorkerGlobalScope&, | 191 WorkerThreadableLoader(WorkerGlobalScope&, |
189 ThreadableLoaderClient*, | 192 ThreadableLoaderClient*, |
190 const ThreadableLoaderOptions&, | 193 const ThreadableLoaderOptions&, |
191 const ResourceLoaderOptions&, | 194 const ResourceLoaderOptions&, |
192 BlockingBehavior); | 195 BlockingBehavior); |
193 void didStart(MainThreadLoaderHolder*); | 196 void didStart(MainThreadLoaderHolder*); |
194 | 197 |
195 void didSendData(unsigned long long bytesSent, | 198 void didSendData(unsigned long long bytesSent, |
196 unsigned long long totalBytesToBeSent); | 199 unsigned long long totalBytesToBeSent); |
197 void didReceiveRedirectTo(const KURL&); | 200 void didReceiveRedirectTo(const KURL&); |
198 void didReceiveResponse(unsigned long identifier, | 201 void didReceiveResponse(unsigned long identifier, |
199 std::unique_ptr<CrossThreadResourceResponseData>, | 202 std::unique_ptr<CrossThreadResourceResponseData>, |
200 std::unique_ptr<WebDataConsumerHandle>); | 203 std::unique_ptr<WebDataConsumerHandle>, |
| 204 double postTaskTime); |
201 void didReceiveData(std::unique_ptr<Vector<char>> data); | 205 void didReceiveData(std::unique_ptr<Vector<char>> data); |
202 void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data); | 206 void didReceiveCachedMetadata(std::unique_ptr<Vector<char>> data); |
203 void didFinishLoading(unsigned long identifier, double finishTime); | 207 void didFinishLoading(unsigned long identifier, double finishTime); |
204 void didFail(const ResourceError&); | 208 void didFail(const ResourceError&); |
205 void didFailAccessControlCheck(const ResourceError&); | 209 void didFailAccessControlCheck(const ResourceError&); |
206 void didFailRedirectCheck(); | 210 void didFailRedirectCheck(); |
207 void didDownloadData(int dataLength); | 211 void didDownloadData(int dataLength); |
208 void didReceiveResourceTiming( | 212 void didReceiveResourceTiming( |
209 std::unique_ptr<CrossThreadResourceTimingInfoData>); | 213 std::unique_ptr<CrossThreadResourceTimingInfoData>); |
210 | 214 |
211 Member<WorkerGlobalScope> m_workerGlobalScope; | 215 Member<WorkerGlobalScope> m_workerGlobalScope; |
212 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 216 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
213 ThreadableLoaderClient* m_client; | 217 ThreadableLoaderClient* m_client; |
214 | 218 |
215 ThreadableLoaderOptions m_threadableLoaderOptions; | 219 ThreadableLoaderOptions m_threadableLoaderOptions; |
216 ResourceLoaderOptions m_resourceLoaderOptions; | 220 ResourceLoaderOptions m_resourceLoaderOptions; |
217 BlockingBehavior m_blockingBehavior; | 221 BlockingBehavior m_blockingBehavior; |
| 222 bool m_isServiceWorker; |
218 | 223 |
219 // |*m_mainThreadLoaderHolder| lives in the main thread. | 224 // |*m_mainThreadLoaderHolder| lives in the main thread. |
220 CrossThreadPersistent<MainThreadLoaderHolder> m_mainThreadLoaderHolder; | 225 CrossThreadPersistent<MainThreadLoaderHolder> m_mainThreadLoaderHolder; |
221 }; | 226 }; |
222 | 227 |
223 } // namespace blink | 228 } // namespace blink |
224 | 229 |
225 #endif // WorkerThreadableLoader_h | 230 #endif // WorkerThreadableLoader_h |
OLD | NEW |