| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 m_webView->close(); | 172 m_webView->close(); |
| 173 m_mainFrame->close(); | 173 m_mainFrame->close(); |
| 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 | |
| 182 bool hasPendingActivity = false; | |
| 183 if (m_mainScriptLoader) { | 181 if (m_mainScriptLoader) { |
| 184 m_mainScriptLoader->cancel(); | 182 m_mainScriptLoader->cancel(); |
| 185 m_mainScriptLoader.clear(); | 183 m_mainScriptLoader.clear(); |
| 186 hasPendingActivity = true; | |
| 187 } | 184 } |
| 188 if (m_workerThread) { | 185 if (m_workerThread) |
| 189 m_workerThread->stop(); | 186 m_workerThread->stop(); |
| 190 hasPendingActivity = true; | |
| 191 } | |
| 192 | |
| 193 if (!hasPendingActivity) { | |
| 194 // If there are no active WorkerThread, |workerGlobalScopeClosed()| | |
| 195 // callback to delete this is never called, so we should clean up here. | |
| 196 delete this; | |
| 197 } | |
| 198 } | 187 } |
| 199 | 188 |
| 200 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) | 189 void WebSharedWorkerImpl::initializeLoader(const WebURL& url) |
| 201 { | 190 { |
| 202 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he | 191 // Create 'shadow page'. This page is never displayed, it is used to proxy t
he |
| 203 // loading requests from the worker context to the rest of WebKit and Chromi
um | 192 // loading requests from the worker context to the rest of WebKit and Chromi
um |
| 204 // infrastructure. | 193 // infrastructure. |
| 205 ASSERT(!m_webView); | 194 ASSERT(!m_webView); |
| 206 m_webView = WebView::create(0); | 195 m_webView = WebView::create(0); |
| 207 m_webView->settings()->setOfflineWebApplicationCacheEnabled(RuntimeEnabledFe
atures::applicationCacheEnabled()); | 196 m_webView->settings()->setOfflineWebApplicationCacheEnabled(RuntimeEnabledFe
atures::applicationCacheEnabled()); |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa
ckendTask, String(message))); | 448 workerThread()->postDebuggerTask(createCrossThreadTask(dispatchOnInspectorBa
ckendTask, String(message))); |
| 460 workerThread()->interruptAndDispatchInspectorCommands(); | 449 workerThread()->interruptAndDispatchInspectorCommands(); |
| 461 } | 450 } |
| 462 | 451 |
| 463 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 452 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 464 { | 453 { |
| 465 return new WebSharedWorkerImpl(client); | 454 return new WebSharedWorkerImpl(client); |
| 466 } | 455 } |
| 467 | 456 |
| 468 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |