| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 createCrossThreadTask( | 243 createCrossThreadTask( |
| 244 &WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, | 244 &WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread, |
| 245 crossThreadUnretained(this), message)); | 245 crossThreadUnretained(this), message)); |
| 246 } | 246 } |
| 247 | 247 |
| 248 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread( | 248 void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread( |
| 249 const String& message) { | 249 const String& message) { |
| 250 m_workerInspectorProxy->dispatchMessageFromWorker(message); | 250 m_workerInspectorProxy->dispatchMessageFromWorker(message); |
| 251 } | 251 } |
| 252 | 252 |
| 253 ParentFrameTaskRunners* WebSharedWorkerImpl::getParentFrameTaskRunners() { | |
| 254 return m_parentFrameTaskRunners.get(); | |
| 255 } | |
| 256 | |
| 257 void WebSharedWorkerImpl::didCloseWorkerGlobalScope() { | 253 void WebSharedWorkerImpl::didCloseWorkerGlobalScope() { |
| 258 getParentFrameTaskRunners() | 254 m_parentFrameTaskRunners->get(TaskType::Internal) |
| 259 ->get(TaskType::Internal) | |
| 260 ->postTask( | 255 ->postTask( |
| 261 BLINK_FROM_HERE, | 256 BLINK_FROM_HERE, |
| 262 crossThreadBind( | 257 crossThreadBind( |
| 263 &WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread, | 258 &WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread, |
| 264 crossThreadUnretained(this))); | 259 crossThreadUnretained(this))); |
| 265 } | 260 } |
| 266 | 261 |
| 267 void WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread() { | 262 void WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread() { |
| 268 m_client->workerContextClosed(); | 263 m_client->workerContextClosed(); |
| 269 | 264 |
| 270 terminateWorkerThread(); | 265 terminateWorkerThread(); |
| 271 } | 266 } |
| 272 | 267 |
| 273 void WebSharedWorkerImpl::didTerminateWorkerThread() { | 268 void WebSharedWorkerImpl::didTerminateWorkerThread() { |
| 274 getParentFrameTaskRunners() | 269 m_parentFrameTaskRunners->get(TaskType::Internal) |
| 275 ->get(TaskType::Internal) | |
| 276 ->postTask(BLINK_FROM_HERE, | 270 ->postTask(BLINK_FROM_HERE, |
| 277 crossThreadBind( | 271 crossThreadBind( |
| 278 &WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread, | 272 &WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread, |
| 279 crossThreadUnretained(this))); | 273 crossThreadUnretained(this))); |
| 280 } | 274 } |
| 281 | 275 |
| 282 void WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread() { | 276 void WebSharedWorkerImpl::didTerminateWorkerThreadOnMainThread() { |
| 283 m_client->workerContextDestroyed(); | 277 m_client->workerContextDestroyed(); |
| 284 // The lifetime of this proxy is controlled by the worker context. | 278 // The lifetime of this proxy is controlled by the worker context. |
| 285 delete this; | 279 delete this; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 if (devtoolsAgent) | 438 if (devtoolsAgent) |
| 445 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, | 439 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, |
| 446 message); | 440 message); |
| 447 } | 441 } |
| 448 | 442 |
| 449 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { | 443 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) { |
| 450 return new WebSharedWorkerImpl(client); | 444 return new WebSharedWorkerImpl(client); |
| 451 } | 445 } |
| 452 | 446 |
| 453 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |