| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 ASSERT(m_webView); | 178 ASSERT(m_webView); |
| 179 // Detach the client before closing the view to avoid getting called back. | 179 // Detach the client before closing the view to avoid getting called back. |
| 180 m_mainFrame->setClient(0); | 180 m_mainFrame->setClient(0); |
| 181 | 181 |
| 182 m_webView->close(); | 182 m_webView->close(); |
| 183 m_mainFrame->close(); | 183 m_mainFrame->close(); |
| 184 if (m_loaderProxy) | 184 if (m_loaderProxy) |
| 185 m_loaderProxy->detachProvider(this); | 185 m_loaderProxy->detachProvider(this); |
| 186 } | 186 } |
| 187 | 187 |
| 188 // TODO(toyoshim): Rename to terminateWorkerThread(). | 188 void WebSharedWorkerImpl::terminateWorkerThread() |
| 189 void WebSharedWorkerImpl::stopWorkerThread() | |
| 190 { | 189 { |
| 191 if (m_askedToTerminate) | 190 if (m_askedToTerminate) |
| 192 return; | 191 return; |
| 193 m_askedToTerminate = true; | 192 m_askedToTerminate = true; |
| 194 if (m_mainScriptLoader) { | 193 if (m_mainScriptLoader) { |
| 195 m_mainScriptLoader->cancel(); | 194 m_mainScriptLoader->cancel(); |
| 196 m_mainScriptLoader.clear(); | 195 m_mainScriptLoader.clear(); |
| 197 if (client()) | 196 if (client()) |
| 198 client()->workerScriptLoadFailed(); | 197 client()->workerScriptLoadFailed(); |
| 199 delete this; | 198 delete this; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void WebSharedWorkerImpl::workerGlobalScopeClosed() | 320 void WebSharedWorkerImpl::workerGlobalScopeClosed() |
| 322 { | 321 { |
| 323 Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(&WebSh
aredWorkerImpl::workerGlobalScopeClosedOnMainThread, AllowCrossThreadAccess(this
))); | 322 Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(&WebSh
aredWorkerImpl::workerGlobalScopeClosedOnMainThread, AllowCrossThreadAccess(this
))); |
| 324 } | 323 } |
| 325 | 324 |
| 326 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread() | 325 void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread() |
| 327 { | 326 { |
| 328 if (client()) | 327 if (client()) |
| 329 client()->workerContextClosed(); | 328 client()->workerContextClosed(); |
| 330 | 329 |
| 331 stopWorkerThread(); | 330 terminateWorkerThread(); |
| 332 } | 331 } |
| 333 | 332 |
| 334 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*) | 333 void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*) |
| 335 { | 334 { |
| 336 } | 335 } |
| 337 | 336 |
| 338 void WebSharedWorkerImpl::workerThreadTerminated() | 337 void WebSharedWorkerImpl::workerThreadTerminated() |
| 339 { | 338 { |
| 340 Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(&WebSh
aredWorkerImpl::workerThreadTerminatedOnMainThread, AllowCrossThreadAccess(this)
)); | 339 Platform::current()->mainThread()->postTask(FROM_HERE, threadSafeBind(&WebSh
aredWorkerImpl::workerThreadTerminatedOnMainThread, AllowCrossThreadAccess(this)
)); |
| 341 } | 340 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 m_mainScriptLoader.clear(); | 426 m_mainScriptLoader.clear(); |
| 428 | 427 |
| 429 workerThread()->start(startupData.release()); | 428 workerThread()->start(startupData.release()); |
| 430 m_workerInspectorProxy->workerThreadCreated(m_loadingDocument.get(), workerT
hread(), m_url); | 429 m_workerInspectorProxy->workerThreadCreated(m_loadingDocument.get(), workerT
hread(), m_url); |
| 431 if (client()) | 430 if (client()) |
| 432 client()->workerScriptLoaded(); | 431 client()->workerScriptLoaded(); |
| 433 } | 432 } |
| 434 | 433 |
| 435 void WebSharedWorkerImpl::terminateWorkerContext() | 434 void WebSharedWorkerImpl::terminateWorkerContext() |
| 436 { | 435 { |
| 437 stopWorkerThread(); | 436 terminateWorkerThread(); |
| 438 } | 437 } |
| 439 | 438 |
| 440 void WebSharedWorkerImpl::clientDestroyed() | 439 void WebSharedWorkerImpl::clientDestroyed() |
| 441 { | 440 { |
| 442 m_client.clear(); | 441 m_client.clear(); |
| 443 } | 442 } |
| 444 | 443 |
| 445 void WebSharedWorkerImpl::pauseWorkerContextOnStart() | 444 void WebSharedWorkerImpl::pauseWorkerContextOnStart() |
| 446 { | 445 { |
| 447 m_pauseWorkerContextOnStart = true; | 446 m_pauseWorkerContextOnStart = true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 477 if (devtoolsAgent) | 476 if (devtoolsAgent) |
| 478 devtoolsAgent->dispatchOnInspectorBackend(message); | 477 devtoolsAgent->dispatchOnInspectorBackend(message); |
| 479 } | 478 } |
| 480 | 479 |
| 481 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) | 480 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) |
| 482 { | 481 { |
| 483 return new WebSharedWorkerImpl(client); | 482 return new WebSharedWorkerImpl(client); |
| 484 } | 483 } |
| 485 | 484 |
| 486 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |