| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 m_workerObject = 0; | 204 m_workerObject = 0; |
| 205 m_executionContext->postTask(createCrossThreadTask(&workerObjectDestroyedInt
ernal, AllowCrossThreadAccess(this))); | 205 m_executionContext->postTask(createCrossThreadTask(&workerObjectDestroyedInt
ernal, AllowCrossThreadAccess(this))); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work
erMessagingProxy* proxy) | 208 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work
erMessagingProxy* proxy) |
| 209 { | 209 { |
| 210 proxy->m_mayBeDestroyed = true; | 210 proxy->m_mayBeDestroyed = true; |
| 211 if (proxy->m_workerThread) | 211 if (proxy->m_workerThread) |
| 212 proxy->terminateWorkerGlobalScope(); | 212 proxy->terminateWorkerGlobalScope(); |
| 213 else | 213 else |
| 214 proxy->workerGlobalScopeDestroyed(); | 214 proxy->workerThreadTerminated(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context, b
ool) | 217 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context, b
ool) |
| 218 { | 218 { |
| 219 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend()
; | 219 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend()
; |
| 220 } | 220 } |
| 221 | 221 |
| 222 void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspec
tor* pageInspector) | 222 void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspec
tor* pageInspector) |
| 223 { | 223 { |
| 224 if (m_askedToTerminate) | 224 if (m_askedToTerminate) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 { | 263 { |
| 264 if (m_askedToTerminate) | 264 if (m_askedToTerminate) |
| 265 return; | 265 return; |
| 266 OwnPtr<ExecutionContextTask> task = createCrossThreadTask(dispatchWriteTimel
ineStartedEvent, String(sessionId)); | 266 OwnPtr<ExecutionContextTask> task = createCrossThreadTask(dispatchWriteTimel
ineStartedEvent, String(sessionId)); |
| 267 if (m_workerThread) | 267 if (m_workerThread) |
| 268 m_workerThread->postTask(task.release()); | 268 m_workerThread->postTask(task.release()); |
| 269 else | 269 else |
| 270 m_queuedEarlyTasks.append(task.release()); | 270 m_queuedEarlyTasks.append(task.release()); |
| 271 } | 271 } |
| 272 | 272 |
| 273 void WorkerMessagingProxy::workerGlobalScopeDestroyed() | 273 void WorkerMessagingProxy::workerThreadTerminated() |
| 274 { | 274 { |
| 275 // This method is always the last to be performed, so the proxy is not neede
d for communication | 275 // This method is always the last to be performed, so the proxy is not neede
d for communication |
| 276 // in either side any more. However, the Worker object may still exist, and
it assumes that the proxy exists, too. | 276 // in either side any more. However, the Worker object may still exist, and
it assumes that the proxy exists, too. |
| 277 m_askedToTerminate = true; | 277 m_askedToTerminate = true; |
| 278 m_workerThread = nullptr; | 278 m_workerThread = nullptr; |
| 279 | 279 |
| 280 InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get
(), this); | 280 InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get
(), this); |
| 281 | 281 |
| 282 if (m_mayBeDestroyed) | 282 if (m_mayBeDestroyed) |
| 283 delete this; | 283 delete this; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 314 { | 314 { |
| 315 m_workerThreadHadPendingActivity = hasPendingActivity; | 315 m_workerThreadHadPendingActivity = hasPendingActivity; |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool WorkerMessagingProxy::hasPendingActivity() const | 318 bool WorkerMessagingProxy::hasPendingActivity() const |
| 319 { | 319 { |
| 320 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; | 320 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace blink | 323 } // namespace blink |
| OLD | NEW |