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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 { | 256 { |
257 ASSERT(!m_workerObject); | 257 ASSERT(!m_workerObject); |
258 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread()) | 258 ASSERT((m_scriptExecutionContext->isDocument() && isMainThread()) |
259 || (m_scriptExecutionContext->isWorkerGlobalScope() && static_cast<Wo
rkerGlobalScope*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()))
; | 259 || (m_scriptExecutionContext->isWorkerGlobalScope() && static_cast<Wo
rkerGlobalScope*>(m_scriptExecutionContext.get())->thread()->isCurrentThread()))
; |
260 } | 260 } |
261 | 261 |
262 void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const S
tring& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) | 262 void WorkerMessagingProxy::startWorkerGlobalScope(const KURL& scriptURL, const S
tring& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) |
263 { | 263 { |
264 // FIXME: This need to be revisited when we support nested worker one day | 264 // FIXME: This need to be revisited when we support nested worker one day |
265 ASSERT(m_scriptExecutionContext->isDocument()); | 265 ASSERT(m_scriptExecutionContext->isDocument()); |
266 Document* document = static_cast<Document*>(m_scriptExecutionContext.get()); | 266 Document* document = toDocument(m_scriptExecutionContext.get()); |
267 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptU
RL, userAgent, sourceCode, *this, *this, startMode, document->contentSecurityPol
icy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderTy
pe(), document->topOrigin(), document->loader()->timing()->referenceMonotonicTim
e()); | 267 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptU
RL, userAgent, sourceCode, *this, *this, startMode, document->contentSecurityPol
icy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedHeaderTy
pe(), document->topOrigin(), document->loader()->timing()->referenceMonotonicTim
e()); |
268 workerThreadCreated(thread); | 268 workerThreadCreated(thread); |
269 thread->start(); | 269 thread->start(); |
270 InspectorInstrumentation::didStartWorkerGlobalScope(m_scriptExecutionContext
.get(), this, scriptURL); | 270 InspectorInstrumentation::didStartWorkerGlobalScope(m_scriptExecutionContext
.get(), this, scriptURL); |
271 } | 271 } |
272 | 272 |
273 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) | 273 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) |
274 { | 274 { |
275 m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channe
ls, this)); | 275 m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channe
ls, this)); |
276 } | 276 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 466 |
467 m_workerThreadHadPendingActivity = hasPendingActivity; | 467 m_workerThreadHadPendingActivity = hasPendingActivity; |
468 } | 468 } |
469 | 469 |
470 bool WorkerMessagingProxy::hasPendingActivity() const | 470 bool WorkerMessagingProxy::hasPendingActivity() const |
471 { | 471 { |
472 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; | 472 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; |
473 } | 473 } |
474 | 474 |
475 } // namespace WebCore | 475 } // namespace WebCore |
OLD | NEW |