| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 m_unconfirmedMessageCount = m_queuedEarlyTasks.size(); | 195 m_unconfirmedMessageCount = m_queuedEarlyTasks.size(); |
| 196 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe
nding activity. | 196 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe
nding activity. |
| 197 | 197 |
| 198 for (auto& earlyTasks : m_queuedEarlyTasks) | 198 for (auto& earlyTasks : m_queuedEarlyTasks) |
| 199 m_workerThread->postTask(FROM_HERE, earlyTasks.release()); | 199 m_workerThread->postTask(FROM_HERE, earlyTasks.release()); |
| 200 m_queuedEarlyTasks.clear(); | 200 m_queuedEarlyTasks.clear(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void WorkerMessagingProxy::workerObjectDestroyed() | 203 void WorkerMessagingProxy::workerObjectDestroyed() |
| 204 { | 204 { |
| 205 m_workerObject = nullptr; | 205 // workerObjectDestroyed() is called in InProcessWorkerBase's destructor. |
| 206 // Thus it should be guaranteed that a weak pointer m_workerObject has been
cleared |
| 207 // before this method gets called. |
| 208 ASSERT(!m_workerObject); |
| 209 |
| 206 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&WorkerMessagi
ngProxy::workerObjectDestroyedInternal, this)); | 210 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&WorkerMessagi
ngProxy::workerObjectDestroyedInternal, this)); |
| 207 } | 211 } |
| 208 | 212 |
| 209 void WorkerMessagingProxy::workerObjectDestroyedInternal() | 213 void WorkerMessagingProxy::workerObjectDestroyedInternal() |
| 210 { | 214 { |
| 211 m_mayBeDestroyed = true; | 215 m_mayBeDestroyed = true; |
| 212 if (m_workerThread) | 216 if (m_workerThread) |
| 213 terminateWorkerGlobalScope(); | 217 terminateWorkerGlobalScope(); |
| 214 else | 218 else |
| 215 workerThreadTerminated(); | 219 workerThreadTerminated(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 290 |
| 287 // FIXME: This need to be revisited when we support nested worker one day | 291 // FIXME: This need to be revisited when we support nested worker one day |
| 288 ASSERT(m_executionContext->isDocument()); | 292 ASSERT(m_executionContext->isDocument()); |
| 289 Document* document = toDocument(m_executionContext.get()); | 293 Document* document = toDocument(m_executionContext.get()); |
| 290 LocalFrame* frame = document->frame(); | 294 LocalFrame* frame = document->frame(); |
| 291 if (frame) | 295 if (frame) |
| 292 frame->console().adoptWorkerMessagesAfterTermination(this); | 296 frame->console().adoptWorkerMessagesAfterTermination(this); |
| 293 } | 297 } |
| 294 | 298 |
| 295 } // namespace blink | 299 } // namespace blink |
| OLD | NEW |