| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual void performTask(ExecutionContext *context) | 72 virtual void performTask(ExecutionContext *context) |
| 73 { | 73 { |
| 74 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 74 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
| 75 // Notify parent that this context is closed. Parent is responsible for
calling WorkerThread::stop(). | 75 // Notify parent that this context is closed. Parent is responsible for
calling WorkerThread::stop(). |
| 76 workerGlobalScope->thread()->workerReportingProxy().workerGlobalScopeClo
sed(); | 76 workerGlobalScope->thread()->workerReportingProxy().workerGlobalScopeClo
sed(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual bool isCleanupTask() const { return true; } | 79 virtual bool isCleanupTask() const { return true; } |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo
rkerClients) | 82 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
orkerThread* thread, double timeOrigin, const SecurityOrigin* starterOrigin, Pas
sOwnPtrWillBeRawPtr<WorkerClients> workerClients) |
| 83 : m_url(url) | 83 : m_url(url) |
| 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 setSecurityOrigin(SecurityOrigin::create(url)); | 94 setSecurityOrigin(SecurityOrigin::create(url)); |
| 95 if (starterOrigin) |
| 96 securityOrigin()->transferPrivileges(*starterOrigin); |
| 97 |
| 95 m_workerClients->reattachThread(); | 98 m_workerClients->reattachThread(); |
| 96 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); | 99 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); |
| 97 } | 100 } |
| 98 | 101 |
| 99 WorkerGlobalScope::~WorkerGlobalScope() | 102 WorkerGlobalScope::~WorkerGlobalScope() |
| 100 { | 103 { |
| 101 } | 104 } |
| 102 | 105 |
| 103 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) | 106 void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& polic
y, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
| 104 { | 107 { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 visitor->trace(m_eventQueue); | 337 visitor->trace(m_eventQueue); |
| 335 visitor->trace(m_workerClients); | 338 visitor->trace(m_workerClients); |
| 336 visitor->trace(m_messageStorage); | 339 visitor->trace(m_messageStorage); |
| 337 HeapSupplementable<WorkerGlobalScope>::trace(visitor); | 340 HeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| 338 #endif | 341 #endif |
| 339 ExecutionContext::trace(visitor); | 342 ExecutionContext::trace(visitor); |
| 340 EventTargetWithInlineData::trace(visitor); | 343 EventTargetWithInlineData::trace(visitor); |
| 341 } | 344 } |
| 342 | 345 |
| 343 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |