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