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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 if (m_askedToTerminate) | 289 if (m_askedToTerminate) |
290 return; | 290 return; |
291 | 291 |
292 if (m_workerThread) { | 292 if (m_workerThread) { |
293 ++m_unconfirmedMessageCount; | 293 ++m_unconfirmedMessageCount; |
294 m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(mess
age, channels)); | 294 m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(mess
age, channels)); |
295 } else | 295 } else |
296 m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, chan
nels)); | 296 m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, chan
nels)); |
297 } | 297 } |
298 | 298 |
299 void WorkerMessagingProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecu
tionContext::Task> task, const String& mode) | 299 bool WorkerMessagingProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecu
tionContext::Task> task, const String& mode) |
300 { | 300 { |
301 if (m_askedToTerminate) | 301 if (m_askedToTerminate) |
302 return; | 302 return false; |
303 | 303 |
304 ASSERT(m_workerThread); | 304 ASSERT(m_workerThread); |
305 m_workerThread->runLoop().postTaskForMode(task, mode); | 305 m_workerThread->runLoop().postTaskForMode(task, mode); |
| 306 return true; |
306 } | 307 } |
307 | 308 |
308 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::T
ask> task) | 309 void WorkerMessagingProxy::postTaskToLoader(PassOwnPtr<ScriptExecutionContext::T
ask> task) |
309 { | 310 { |
310 // FIXME: In case of nested workers, this should go directly to the root Doc
ument context. | 311 // FIXME: In case of nested workers, this should go directly to the root Doc
ument context. |
311 ASSERT(m_scriptExecutionContext->isDocument()); | 312 ASSERT(m_scriptExecutionContext->isDocument()); |
312 m_scriptExecutionContext->postTask(task); | 313 m_scriptExecutionContext->postTask(task); |
313 } | 314 } |
314 | 315 |
315 void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessag
e, int lineNumber, const String& sourceURL) | 316 void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessag
e, int lineNumber, const String& sourceURL) |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 489 } |
489 | 490 |
490 bool WorkerMessagingProxy::hasPendingActivity() const | 491 bool WorkerMessagingProxy::hasPendingActivity() const |
491 { | 492 { |
492 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; | 493 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; |
493 } | 494 } |
494 | 495 |
495 } // namespace WebCore | 496 } // namespace WebCore |
496 | 497 |
497 #endif // ENABLE(WORKERS) | 498 #endif // ENABLE(WORKERS) |
OLD | NEW |