Chromium Code Reviews| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 } | 174 } |
| 175 | 175 |
| 176 void WebSharedWorkerImpl::stopWorkerThread() | 176 void WebSharedWorkerImpl::stopWorkerThread() |
| 177 { | 177 { |
| 178 if (m_askedToTerminate) | 178 if (m_askedToTerminate) |
| 179 return; | 179 return; |
| 180 m_askedToTerminate = true; | 180 m_askedToTerminate = true; |
| 181 if (m_mainScriptLoader) { | 181 if (m_mainScriptLoader) { |
| 182 m_mainScriptLoader->cancel(); | 182 m_mainScriptLoader->cancel(); |
| 183 m_mainScriptLoader.clear(); | 183 m_mainScriptLoader.clear(); |
| 184 if (client()) | |
| 185 client()->workerScriptLoadFailed(); | |
| 186 delete this; | |
|
sof
2014/08/12 05:02:12
Shouldn't this return early?
horo
2014/08/12 05:41:45
Ah, yes.
I'll revert this patch.
| |
| 184 } | 187 } |
| 185 if (m_workerThread) | 188 if (m_workerThread) |
| 186 m_workerThread->stop(); | 189 m_workerThread->stop(); |
| 187 } | 190 } |
| 188 | 191 |
| 189 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) | 192 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) |
| 190 { | 193 { |
| 191 // Create 'shadow page'. This page is never displayed, it is used to proxy t he | 194 // Create 'shadow page'. This page is never displayed, it is used to proxy t he |
| 192 // loading requests from the worker context to the rest of WebKit and Chromi um | 195 // loading requests from the worker context to the rest of WebKit and Chromi um |
| 193 // infrastructure. | 196 // infrastructure. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 | 342 |
| 340 static void connectToWorkerContextInspectorTask(ExecutionContext* context, bool) | 343 static void connectToWorkerContextInspectorTask(ExecutionContext* context, bool) |
| 341 { | 344 { |
| 342 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend() ; | 345 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend() ; |
| 343 } | 346 } |
| 344 | 347 |
| 345 void WebSharedWorkerImpl::onScriptLoaderFinished() | 348 void WebSharedWorkerImpl::onScriptLoaderFinished() |
| 346 { | 349 { |
| 347 ASSERT(m_loadingDocument); | 350 ASSERT(m_loadingDocument); |
| 348 ASSERT(m_mainScriptLoader); | 351 ASSERT(m_mainScriptLoader); |
| 349 if (m_mainScriptLoader->failed() || m_askedToTerminate) { | 352 if (m_askedToTerminate) |
| 353 return; | |
| 354 if (m_mainScriptLoader->failed()) { | |
| 350 m_mainScriptLoader->cancel(); | 355 m_mainScriptLoader->cancel(); |
| 351 if (client()) | 356 if (client()) |
| 352 client()->workerScriptLoadFailed(); | 357 client()->workerScriptLoadFailed(); |
| 353 | 358 |
| 354 // The SharedWorker was unable to load the initial script, so | 359 // The SharedWorker was unable to load the initial script, so |
| 355 // shut it down right here unless we're here handling a load | 360 // shut it down right here. |
| 356 // cancellation failure triggered by an explicit shared worker | 361 delete this; |
| 357 // termination call (via terminateWorkerContext().) | |
| 358 if (!m_askedToTerminate) | |
| 359 delete this; | |
| 360 return; | 362 return; |
| 361 } | 363 } |
| 362 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; | 364 WorkerThreadStartMode startMode = m_pauseWorkerContextOnStart ? PauseWorkerG lobalScopeOnStart : DontPauseWorkerGlobalScopeOnStart; |
| 363 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); | 365 OwnPtrWillBeRawPtr<WorkerClients> workerClients = WorkerClients::create(); |
| 364 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c reate()); | 366 provideLocalFileSystemToWorker(workerClients.get(), LocalFileSystemClient::c reate()); |
| 365 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat e()); | 367 provideDatabaseClientToWorker(workerClients.get(), DatabaseClientImpl::creat e()); |
| 366 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); | 368 WebSecurityOrigin webSecurityOrigin(m_loadingDocument->securityOrigin()); |
| 367 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea teWorkerPermissionClientProxy(webSecurityOrigin))); | 369 providePermissionClientToWorker(workerClients.get(), adoptPtr(client()->crea teWorkerPermissionClientProxy(webSecurityOrigin))); |
| 368 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc ript(), startMode, m_contentSecurityPolicy, static_cast<blink::ContentSecurityPo licyHeaderType>(m_policyType), workerClients.release()); | 370 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu pData::create(m_url, m_loadingDocument->userAgent(m_url), m_mainScriptLoader->sc ript(), startMode, m_contentSecurityPolicy, static_cast<blink::ContentSecurityPo licyHeaderType>(m_policyType), workerClients.release()); |
| 369 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData .release())); | 371 setWorkerThread(SharedWorkerThread::create(m_name, *this, *this, startupData .release())); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa ckendTask, String(message))); | 450 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa ckendTask, String(message))); |
| 449 workerThread()->interruptAndDispatchInspectorCommands(); | 451 workerThread()->interruptAndDispatchInspectorCommands(); |
| 450 } | 452 } |
| 451 | 453 |
| 452 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 454 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 453 { | 455 { |
| 454 return new WebSharedWorkerImpl(client); | 456 return new WebSharedWorkerImpl(client); |
| 455 } | 457 } |
| 456 | 458 |
| 457 } // namespace blink | 459 } // namespace blink |
| OLD | NEW |