| 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, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 , m_userAgent(userAgent) | 84 , m_userAgent(userAgent) |
| 85 , m_script(adoptPtr(new WorkerScriptController(*this))) | 85 , m_script(adoptPtr(new WorkerScriptController(*this))) |
| 86 , m_thread(thread) | 86 , m_thread(thread) |
| 87 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll
er(this))) | 87 , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorControll
er(this))) |
| 88 , m_closing(false) | 88 , m_closing(false) |
| 89 , m_eventQueue(WorkerEventQueue::create(this)) | 89 , m_eventQueue(WorkerEventQueue::create(this)) |
| 90 , m_workerClients(workerClients) | 90 , m_workerClients(workerClients) |
| 91 , m_timeOrigin(timeOrigin) | 91 , m_timeOrigin(timeOrigin) |
| 92 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) | 92 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) |
| 93 { | 93 { |
| 94 setClient(this); | |
| 95 setSecurityOrigin(SecurityOrigin::create(url)); | 94 setSecurityOrigin(SecurityOrigin::create(url)); |
| 96 m_workerClients->reattachThread(); | 95 m_workerClients->reattachThread(); |
| 97 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); | 96 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); |
| 98 } | 97 } |
| 99 | 98 |
| 100 WorkerGlobalScope::~WorkerGlobalScope() | 99 WorkerGlobalScope::~WorkerGlobalScope() |
| 101 { | 100 { |
| 102 } | 101 } |
| 103 | 102 |
| 104 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) | 103 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 m_workerInspectorController.clear(); | 194 m_workerInspectorController.clear(); |
| 196 } | 195 } |
| 197 | 196 |
| 198 void WorkerGlobalScope::dispose() | 197 void WorkerGlobalScope::dispose() |
| 199 { | 198 { |
| 200 ASSERT(thread()->isCurrentThread()); | 199 ASSERT(thread()->isCurrentThread()); |
| 201 | 200 |
| 202 m_eventQueue->close(); | 201 m_eventQueue->close(); |
| 203 clearScript(); | 202 clearScript(); |
| 204 clearInspector(); | 203 clearInspector(); |
| 205 setClient(0); | |
| 206 | |
| 207 // We do not clear the thread field of the | 204 // We do not clear the thread field of the |
| 208 // WorkerGlobalScope. Other objects keep the worker global scope | 205 // WorkerGlobalScope. Other objects keep the worker global scope |
| 209 // alive because they need its thread field to check that work is | 206 // alive because they need its thread field to check that work is |
| 210 // being carried out on the right thread. We therefore cannot clear | 207 // being carried out on the right thread. We therefore cannot clear |
| 211 // the thread field before all references to the worker global | 208 // the thread field before all references to the worker global |
| 212 // scope are gone. | 209 // scope are gone. |
| 213 } | 210 } |
| 214 | 211 |
| 215 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState
& exceptionState) | 212 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState
& exceptionState) |
| 216 { | 213 { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c
onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr
<ScriptCallStack>) | 262 void WorkerGlobalScope::logExceptionToConsole(const String& errorMessage, int, c
onst String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr
<ScriptCallStack>) |
| 266 { | 263 { |
| 267 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c
olumnNumber, sourceURL); | 264 thread()->workerReportingProxy().reportException(errorMessage, lineNumber, c
olumnNumber, sourceURL); |
| 268 } | 265 } |
| 269 | 266 |
| 270 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di
rectiveText) | 267 void WorkerGlobalScope::reportBlockedScriptExecutionToInspector(const String& di
rectiveText) |
| 271 { | 268 { |
| 272 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); | 269 InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| 273 } | 270 } |
| 274 | 271 |
| 275 void WorkerGlobalScope::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> prpCon
soleMessage) | 272 void WorkerGlobalScope::addConsoleMessage(PassRefPtrWillBeRawPtr<ConsoleMessage>
prpConsoleMessage) |
| 276 { | 273 { |
| 277 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; | 274 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = prpConsoleMessage; |
| 278 if (!isContextThread()) { | 275 if (!isContextThread()) { |
| 279 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console
Message->level(), consoleMessage->message())); | 276 postTask(AddConsoleMessageTask::create(consoleMessage->source(), console
Message->level(), consoleMessage->message())); |
| 280 return; | 277 return; |
| 281 } | 278 } |
| 282 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); | 279 thread()->workerReportingProxy().reportConsoleMessage(consoleMessage); |
| 283 addMessageToWorkerConsole(consoleMessage.release()); | 280 addMessageToWorkerConsole(consoleMessage.release()); |
| 284 } | 281 } |
| 285 | 282 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 visitor->trace(m_workerInspectorController); | 329 visitor->trace(m_workerInspectorController); |
| 333 visitor->trace(m_eventQueue); | 330 visitor->trace(m_eventQueue); |
| 334 visitor->trace(m_workerClients); | 331 visitor->trace(m_workerClients); |
| 335 visitor->trace(m_messageStorage); | 332 visitor->trace(m_messageStorage); |
| 336 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 333 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| 337 ExecutionContext::trace(visitor); | 334 ExecutionContext::trace(visitor); |
| 338 EventTargetWithInlineData::trace(visitor); | 335 EventTargetWithInlineData::trace(visitor); |
| 339 } | 336 } |
| 340 | 337 |
| 341 } // namespace blink | 338 } // namespace blink |
| OLD | NEW |