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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 toWebFrameImpl(m_mainFrame)->frame()->document(), | 211 toWebFrameImpl(m_mainFrame)->frame()->document(), |
212 m_workerStartData.scriptURL, | 212 m_workerStartData.scriptURL, |
213 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this)); | 213 bind(&WebEmbeddedWorkerImpl::onScriptLoaderFinished, this)); |
214 } | 214 } |
215 | 215 |
216 void WebEmbeddedWorkerImpl::onScriptLoaderFinished() | 216 void WebEmbeddedWorkerImpl::onScriptLoaderFinished() |
217 { | 217 { |
218 ASSERT(m_mainScriptLoader); | 218 ASSERT(m_mainScriptLoader); |
219 | 219 |
220 if (m_mainScriptLoader->failed() || m_askedToTerminate) { | 220 if (m_mainScriptLoader->failed() || m_askedToTerminate) { |
| 221 m_mainScriptLoader.clear(); |
| 222 // This may delete 'this'. |
221 m_workerContextClient->workerContextFailedToStart(); | 223 m_workerContextClient->workerContextFailedToStart(); |
222 m_mainScriptLoader.clear(); | |
223 return; | 224 return; |
224 } | 225 } |
225 | 226 |
226 WorkerThreadStartMode startMode = | 227 WorkerThreadStartMode startMode = |
227 (m_workerStartData.startMode == WebEmbeddedWorkerStartModePauseOnStart) | 228 (m_workerStartData.startMode == WebEmbeddedWorkerStartModePauseOnStart) |
228 ? PauseWorkerGlobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; | 229 ? PauseWorkerGlobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |
229 | 230 |
230 // This is to be owned by ServiceWorker's WorkerGlobalScope, and is | 231 // This is to be owned by ServiceWorker's WorkerGlobalScope, and is |
231 // guaranteed to be around while the WorkerGlobalScope is alive. | 232 // guaranteed to be around while the WorkerGlobalScope is alive. |
232 WebServiceWorkerContextClient* contextClient = m_workerContextClient.get(); | 233 WebServiceWorkerContextClient* contextClient = m_workerContextClient.get(); |
(...skipping 16 matching lines...) Expand all Loading... |
249 m_mainScriptLoader.clear(); | 250 m_mainScriptLoader.clear(); |
250 | 251 |
251 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); | 252 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW
ebFrameImpl(m_mainFrame)->frame()->document(), *contextClient); |
252 m_loaderProxy = LoaderProxy::create(*this); | 253 m_loaderProxy = LoaderProxy::create(*this); |
253 | 254 |
254 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); | 255 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal
ScopeProxy, startupData.release()); |
255 m_workerThread->start(); | 256 m_workerThread->start(); |
256 } | 257 } |
257 | 258 |
258 } // namespace blink | 259 } // namespace blink |
OLD | NEW |