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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, PassOwnPtrWillBeRawPtr<WorkerClients> wo
rkerClients) |
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_terminationObserver(0) | |
93 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) | 92 , m_messageStorage(ConsoleMessageStorage::createForWorker(this)) |
94 { | 93 { |
95 setClient(this); | 94 setClient(this); |
96 setSecurityOrigin(SecurityOrigin::create(url)); | 95 setSecurityOrigin(SecurityOrigin::create(url)); |
97 m_workerClients->reattachThread(); | 96 m_workerClients->reattachThread(); |
98 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); | 97 m_thread->setWorkerInspectorController(m_workerInspectorController.get()); |
99 } | 98 } |
100 | 99 |
101 WorkerGlobalScope::~WorkerGlobalScope() | 100 WorkerGlobalScope::~WorkerGlobalScope() |
102 { | 101 { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
e::dispose. | 188 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
e::dispose. |
190 void WorkerGlobalScope::clearInspector() | 189 void WorkerGlobalScope::clearInspector() |
191 { | 190 { |
192 if (!m_workerInspectorController) | 191 if (!m_workerInspectorController) |
193 return; | 192 return; |
194 thread()->setWorkerInspectorController(nullptr); | 193 thread()->setWorkerInspectorController(nullptr); |
195 m_workerInspectorController->dispose(); | 194 m_workerInspectorController->dispose(); |
196 m_workerInspectorController.clear(); | 195 m_workerInspectorController.clear(); |
197 } | 196 } |
198 | 197 |
199 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe
r) | |
200 { | |
201 ASSERT(!m_terminationObserver); | |
202 ASSERT(observer); | |
203 m_terminationObserver = observer; | |
204 } | |
205 | |
206 void WorkerGlobalScope::wasRequestedToTerminate() | |
207 { | |
208 if (m_terminationObserver) | |
209 m_terminationObserver->wasRequestedToTerminate(); | |
210 } | |
211 | |
212 void WorkerGlobalScope::dispose() | 198 void WorkerGlobalScope::dispose() |
213 { | 199 { |
214 ASSERT(thread()->isCurrentThread()); | 200 ASSERT(thread()->isCurrentThread()); |
215 | 201 |
216 m_eventQueue->close(); | 202 m_eventQueue->close(); |
217 clearScript(); | 203 clearScript(); |
218 clearInspector(); | 204 clearInspector(); |
219 setClient(0); | 205 setClient(0); |
220 | 206 |
221 // We do not clear the thread field of the | 207 // We do not clear the thread field of the |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 visitor->trace(m_workerInspectorController); | 332 visitor->trace(m_workerInspectorController); |
347 visitor->trace(m_eventQueue); | 333 visitor->trace(m_eventQueue); |
348 visitor->trace(m_workerClients); | 334 visitor->trace(m_workerClients); |
349 visitor->trace(m_messageStorage); | 335 visitor->trace(m_messageStorage); |
350 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 336 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
351 ExecutionContext::trace(visitor); | 337 ExecutionContext::trace(visitor); |
352 EventTargetWithInlineData::trace(visitor); | 338 EventTargetWithInlineData::trace(visitor); |
353 } | 339 } |
354 | 340 |
355 } // namespace blink | 341 } // namespace blink |
OLD | NEW |