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 21 matching lines...) Expand all Loading... |
32 #include "core/dom/CrossThreadTask.h" | 32 #include "core/dom/CrossThreadTask.h" |
33 #include "core/dom/Document.h" | 33 #include "core/dom/Document.h" |
34 #include "core/dom/ErrorEvent.h" | 34 #include "core/dom/ErrorEvent.h" |
35 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/MessageEvent.h" | 36 #include "core/dom/MessageEvent.h" |
37 #include "core/dom/ScriptExecutionContext.h" | 37 #include "core/dom/ScriptExecutionContext.h" |
38 #include "core/inspector/InspectorInstrumentation.h" | 38 #include "core/inspector/InspectorInstrumentation.h" |
39 #include "core/inspector/ScriptCallStack.h" | 39 #include "core/inspector/ScriptCallStack.h" |
40 #include "core/inspector/WorkerDebuggerAgent.h" | 40 #include "core/inspector/WorkerDebuggerAgent.h" |
41 #include "core/inspector/WorkerInspectorController.h" | 41 #include "core/inspector/WorkerInspectorController.h" |
| 42 #include "core/loader/DocumentLoadTiming.h" |
| 43 #include "core/loader/DocumentLoader.h" |
42 #include "core/page/ContentSecurityPolicy.h" | 44 #include "core/page/ContentSecurityPolicy.h" |
43 #include "core/page/DOMWindow.h" | 45 #include "core/page/DOMWindow.h" |
44 #include "core/page/PageGroup.h" | 46 #include "core/page/PageGroup.h" |
45 #include "core/platform/NotImplemented.h" | 47 #include "core/platform/NotImplemented.h" |
46 #include "core/workers/DedicatedWorkerContext.h" | 48 #include "core/workers/DedicatedWorkerContext.h" |
47 #include "core/workers/DedicatedWorkerThread.h" | 49 #include "core/workers/DedicatedWorkerThread.h" |
48 #include "core/workers/Worker.h" | 50 #include "core/workers/Worker.h" |
49 #include <wtf/MainThread.h> | 51 #include <wtf/MainThread.h> |
50 | 52 |
51 namespace WebCore { | 53 namespace WebCore { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 } | 260 } |
259 | 261 |
260 void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin
g& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) | 262 void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin
g& userAgent, const String& sourceCode, WorkerThreadStartMode startMode) |
261 { | 263 { |
262 // 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 |
263 ASSERT(m_scriptExecutionContext->isDocument()); | 265 ASSERT(m_scriptExecutionContext->isDocument()); |
264 Document* document = static_cast<Document*>(m_scriptExecutionContext.get()); | 266 Document* document = static_cast<Document*>(m_scriptExecutionContext.get()); |
265 GroupSettings* settings = 0; | 267 GroupSettings* settings = 0; |
266 if (document->page()) | 268 if (document->page()) |
267 settings = document->page()->group().groupSettings(); | 269 settings = document->page()->group().groupSettings(); |
268 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptU
RL, userAgent, settings, sourceCode, *this, *this, startMode, document->contentS
ecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecat
edHeaderType(), document->topOrigin()); | 270 RefPtr<DedicatedWorkerThread> thread = DedicatedWorkerThread::create(scriptU
RL, userAgent, settings, sourceCode, *this, *this, startMode, document->contentS
ecurityPolicy()->deprecatedHeader(), document->contentSecurityPolicy()->deprecat
edHeaderType(), document->topOrigin(), document->loader()->timing()->referenceMo
notonicTime()); |
269 workerThreadCreated(thread); | 271 workerThreadCreated(thread); |
270 thread->start(); | 272 thread->start(); |
271 InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get
(), this, scriptURL); | 273 InspectorInstrumentation::didStartWorkerContext(m_scriptExecutionContext.get
(), this, scriptURL); |
272 } | 274 } |
273 | 275 |
274 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) | 276 void WorkerMessagingProxy::postMessageToWorkerObject(PassRefPtr<SerializedScript
Value> message, PassOwnPtr<MessagePortChannelArray> channels) |
275 { | 277 { |
276 m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channe
ls, this)); | 278 m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channe
ls, this)); |
277 } | 279 } |
278 | 280 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 469 |
468 m_workerThreadHadPendingActivity = hasPendingActivity; | 470 m_workerThreadHadPendingActivity = hasPendingActivity; |
469 } | 471 } |
470 | 472 |
471 bool WorkerMessagingProxy::hasPendingActivity() const | 473 bool WorkerMessagingProxy::hasPendingActivity() const |
472 { | 474 { |
473 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; | 475 return (m_unconfirmedMessageCount || m_workerThreadHadPendingActivity) && !m
_askedToTerminate; |
474 } | 476 } |
475 | 477 |
476 } // namespace WebCore | 478 } // namespace WebCore |
OLD | NEW |