| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // FIXME: This need to be revisited when we support nested worker one day | 114 // FIXME: This need to be revisited when we support nested worker one day |
| 115 ASSERT(m_executionContext->isDocument()); | 115 ASSERT(m_executionContext->isDocument()); |
| 116 Document* document = toDocument(m_executionContext.get()); | 116 Document* document = toDocument(m_executionContext.get()); |
| 117 | 117 |
| 118 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(scriptURL, userAgent, sourceCode, startMode, document->contentSecu
rityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedH
eaderType(), m_workerClients.release()); | 118 OwnPtrWillBeRawPtr<WorkerThreadStartupData> startupData = WorkerThreadStartu
pData::create(scriptURL, userAgent, sourceCode, startMode, document->contentSecu
rityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecatedH
eaderType(), m_workerClients.release()); |
| 119 double originTime = document->loader() ? document->loader()->timing()->refer
enceMonotonicTime() : monotonicallyIncreasingTime(); | 119 double originTime = document->loader() ? document->loader()->timing()->refer
enceMonotonicTime() : monotonicallyIncreasingTime(); |
| 120 | 120 |
| 121 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(*this,
*m_workerObjectProxy.get(), originTime, startupData.release()); | 121 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(*this,
*m_workerObjectProxy.get(), originTime, startupData.release()); |
| 122 thread->start(); | 122 thread->start(); |
| 123 workerThreadCreated(thread); | 123 workerThreadCreated(thread); |
| 124 InspectorInstrumentation::didStartWorkerGlobalScope(m_executionContext.get()
, this, scriptURL); | 124 InspectorInstrumentation::didStartWorker(m_executionContext.get(), this, scr
iptURL); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) | 127 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) |
| 128 { | 128 { |
| 129 if (!m_workerObject || m_askedToTerminate) | 129 if (!m_workerObject || m_askedToTerminate) |
| 130 return; | 130 return; |
| 131 | 131 |
| 132 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_e
xecutionContext.get(), channels); | 132 OwnPtrWillBeRawPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_e
xecutionContext.get(), channels); |
| 133 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message)
); | 133 m_workerObject->dispatchEvent(MessageEvent::create(ports.release(), message)
); |
| 134 } | 134 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 proxy->terminateWorkerGlobalScope(); | 224 proxy->terminateWorkerGlobalScope(); |
| 225 else | 225 else |
| 226 proxy->workerThreadTerminated(); | 226 proxy->workerThreadTerminated(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context, b
ool) | 229 static void connectToWorkerGlobalScopeInspectorTask(ExecutionContext* context, b
ool) |
| 230 { | 230 { |
| 231 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend()
; | 231 toWorkerGlobalScope(context)->workerInspectorController()->connectFrontend()
; |
| 232 } | 232 } |
| 233 | 233 |
| 234 void WorkerMessagingProxy::connectToInspector(WorkerGlobalScopeProxy::PageInspec
tor* pageInspector) | 234 void WorkerMessagingProxy::connectToInspector(WorkerInspectorProxy::PageInspecto
r* pageInspector) |
| 235 { | 235 { |
| 236 if (m_askedToTerminate) | 236 if (m_askedToTerminate) |
| 237 return; | 237 return; |
| 238 ASSERT(!m_pageInspector); | 238 ASSERT(!m_pageInspector); |
| 239 m_pageInspector = pageInspector; | 239 m_pageInspector = pageInspector; |
| 240 m_workerThread->postDebuggerTask(createCrossThreadTask(connectToWorkerGlobal
ScopeInspectorTask, true)); | 240 m_workerThread->postDebuggerTask(createCrossThreadTask(connectToWorkerGlobal
ScopeInspectorTask, true)); |
| 241 } | 241 } |
| 242 | 242 |
| 243 static void disconnectFromWorkerGlobalScopeInspectorTask(ExecutionContext* conte
xt, bool) | 243 static void disconnectFromWorkerGlobalScopeInspectorTask(ExecutionContext* conte
xt, bool) |
| 244 { | 244 { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 m_workerThreadHadPendingActivity = hasPendingActivity; | 325 m_workerThreadHadPendingActivity = hasPendingActivity; |
| 326 } | 326 } |
| 327 | 327 |
| 328 bool WorkerMessagingProxy::hasPendingActivity() const | 328 bool WorkerMessagingProxy::hasPendingActivity() const |
| 329 { | 329 { |
| 330 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; | 330 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; |
| 331 } | 331 } |
| 332 | 332 |
| 333 void WorkerMessagingProxy::terminateInternally() | 333 void WorkerMessagingProxy::terminateInternally() |
| 334 { | 334 { |
| 335 InspectorInstrumentation::workerGlobalScopeTerminated(m_executionContext.get
(), this); | 335 InspectorInstrumentation::workerTerminated(m_executionContext.get(), this); |
| 336 | 336 |
| 337 // FIXME: This need to be revisited when we support nested worker one day | 337 // FIXME: This need to be revisited when we support nested worker one day |
| 338 ASSERT(m_executionContext->isDocument()); | 338 ASSERT(m_executionContext->isDocument()); |
| 339 Document* document = toDocument(m_executionContext.get()); | 339 Document* document = toDocument(m_executionContext.get()); |
| 340 LocalFrame* frame = document->frame(); | 340 LocalFrame* frame = document->frame(); |
| 341 if (frame) | 341 if (frame) |
| 342 frame->console().adoptWorkerConsoleMessages(this); | 342 frame->console().adoptWorkerConsoleMessages(this); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace blink | 345 } // namespace blink |
| OLD | NEW |