| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 ASSERT(m_workerThread); | 160 ASSERT(m_workerThread); |
| 161 m_workerThread->postTask(task); | 161 m_workerThread->postTask(task); |
| 162 return true; | 162 return true; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ExecutionContextTask> tas
k) | 165 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ExecutionContextTask> tas
k) |
| 166 { | 166 { |
| 167 // FIXME: In case of nested workers, this should go directly to the root Doc
ument context. | 167 // FIXME: In case of nested workers, this should go directly to the root Doc
ument context. |
| 168 ASSERT(m_executionContext->isDocument()); | 168 ASSERT(m_executionContext->isDocument()); |
| 169 m_executionContext->postTask(FROM_HERE, task); | 169 m_executionContext->postTask(task); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WorkerMessagingProxy::reportException(const String& errorMessage, int lineN
umber, int columnNumber, const String& sourceURL, int exceptionId) | 172 void WorkerMessagingProxy::reportException(const String& errorMessage, int lineN
umber, int columnNumber, const String& sourceURL, int exceptionId) |
| 173 { | 173 { |
| 174 if (!m_workerObject) | 174 if (!m_workerObject) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 // We don't bother checking the askedToTerminate() flag here, because except
ions should *always* be reported even if the thread is terminated. | 177 // We don't bother checking the askedToTerminate() flag here, because except
ions should *always* be reported even if the thread is terminated. |
| 178 // This is intentionally different than the behavior in MessageWorkerTask, b
ecause terminated workers no longer deliver messages (section 4.6 of the WebWork
er spec), but they do report exceptions. | 178 // This is intentionally different than the behavior in MessageWorkerTask, b
ecause terminated workers no longer deliver messages (section 4.6 of the WebWork
er spec), but they do report exceptions. |
| 179 | 179 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 209 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe
nding activity. | 209 m_workerThreadHadPendingActivity = true; // Worker initialization means a pe
nding activity. |
| 210 | 210 |
| 211 for (auto& earlyTasks : m_queuedEarlyTasks) | 211 for (auto& earlyTasks : m_queuedEarlyTasks) |
| 212 m_workerThread->postTask(earlyTasks.release()); | 212 m_workerThread->postTask(earlyTasks.release()); |
| 213 m_queuedEarlyTasks.clear(); | 213 m_queuedEarlyTasks.clear(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void WorkerMessagingProxy::workerObjectDestroyed() | 216 void WorkerMessagingProxy::workerObjectDestroyed() |
| 217 { | 217 { |
| 218 m_workerObject = nullptr; | 218 m_workerObject = nullptr; |
| 219 m_executionContext->postTask(FROM_HERE, createCrossThreadTask(&workerObjectD
estroyedInternal, AllowCrossThreadAccess(this))); | 219 m_executionContext->postTask(createCrossThreadTask(&workerObjectDestroyedInt
ernal, AllowCrossThreadAccess(this))); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work
erMessagingProxy* proxy) | 222 void WorkerMessagingProxy::workerObjectDestroyedInternal(ExecutionContext*, Work
erMessagingProxy* proxy) |
| 223 { | 223 { |
| 224 proxy->m_mayBeDestroyed = true; | 224 proxy->m_mayBeDestroyed = true; |
| 225 if (proxy->m_workerThread) | 225 if (proxy->m_workerThread) |
| 226 proxy->terminateWorkerGlobalScope(); | 226 proxy->terminateWorkerGlobalScope(); |
| 227 else | 227 else |
| 228 proxy->workerThreadTerminated(); | 228 proxy->workerThreadTerminated(); |
| 229 } | 229 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 // FIXME: This need to be revisited when we support nested worker one day | 300 // FIXME: This need to be revisited when we support nested worker one day |
| 301 ASSERT(m_executionContext->isDocument()); | 301 ASSERT(m_executionContext->isDocument()); |
| 302 Document* document = toDocument(m_executionContext.get()); | 302 Document* document = toDocument(m_executionContext.get()); |
| 303 LocalFrame* frame = document->frame(); | 303 LocalFrame* frame = document->frame(); |
| 304 if (frame) | 304 if (frame) |
| 305 frame->console().adoptWorkerMessagesAfterTermination(this); | 305 frame->console().adoptWorkerMessagesAfterTermination(this); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace blink | 308 } // namespace blink |
| OLD | NEW |