| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual bool isCleanupTask() const { return true; } | 76 virtual bool isCleanupTask() const { return true; } |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo
rkerClients) | 79 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo
rkerClients) |
| 80 : m_url(url) | 80 : m_url(url) |
| 81 , m_userAgent(userAgent) | 81 , m_userAgent(userAgent) |
| 82 , m_script(adoptPtr(new WorkerScriptController(*this))) | 82 , m_script(adoptPtr(new WorkerScriptController(*this))) |
| 83 , m_thread(thread) | 83 , m_thread(thread) |
| 84 , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) | 84 , m_workerInspectorController(adoptPtrWillBeNoop(new WorkerInspectorControll
er(this))) |
| 85 , m_closing(false) | 85 , m_closing(false) |
| 86 , m_eventQueue(WorkerEventQueue::create(this)) | 86 , m_eventQueue(WorkerEventQueue::create(this)) |
| 87 , m_workerClients(workerClients) | 87 , m_workerClients(workerClients) |
| 88 , m_timeOrigin(timeOrigin) | 88 , m_timeOrigin(timeOrigin) |
| 89 , m_terminationObserver(0) | 89 , m_terminationObserver(0) |
| 90 { | 90 { |
| 91 ScriptWrappable::init(this); | 91 ScriptWrappable::init(this); |
| 92 setClient(this); | 92 setClient(this); |
| 93 setSecurityOrigin(SecurityOrigin::create(url)); | 93 setSecurityOrigin(SecurityOrigin::create(url)); |
| 94 m_workerClients->reattachThread(); | 94 m_workerClients->reattachThread(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (!m_navigator) | 175 if (!m_navigator) |
| 176 m_navigator = WorkerNavigator::create(m_userAgent); | 176 m_navigator = WorkerNavigator::create(m_userAgent); |
| 177 return m_navigator.get(); | 177 return m_navigator.get(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) | 180 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) |
| 181 { | 181 { |
| 182 thread()->runLoop().postTask(task); | 182 thread()->runLoop().postTask(task); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
e::dispose. |
| 185 void WorkerGlobalScope::clearInspector() | 186 void WorkerGlobalScope::clearInspector() |
| 186 { | 187 { |
| 188 if (!m_workerInspectorController) |
| 189 return; |
| 190 m_workerInspectorController->dispose(); |
| 187 m_workerInspectorController.clear(); | 191 m_workerInspectorController.clear(); |
| 188 } | 192 } |
| 189 | 193 |
| 190 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe
r) | 194 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe
r) |
| 191 { | 195 { |
| 192 ASSERT(!m_terminationObserver); | 196 ASSERT(!m_terminationObserver); |
| 193 ASSERT(observer); | 197 ASSERT(observer); |
| 194 m_terminationObserver = observer; | 198 m_terminationObserver = observer; |
| 195 } | 199 } |
| 196 | 200 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const | 335 void WorkerGlobalScope::countDeprecation(UseCounter::Feature) const |
| 332 { | 336 { |
| 333 // FIXME: How should we count features for shared/service workers? | 337 // FIXME: How should we count features for shared/service workers? |
| 334 } | 338 } |
| 335 | 339 |
| 336 void WorkerGlobalScope::trace(Visitor* visitor) | 340 void WorkerGlobalScope::trace(Visitor* visitor) |
| 337 { | 341 { |
| 338 visitor->trace(m_console); | 342 visitor->trace(m_console); |
| 339 visitor->trace(m_location); | 343 visitor->trace(m_location); |
| 340 visitor->trace(m_navigator); | 344 visitor->trace(m_navigator); |
| 345 visitor->trace(m_workerInspectorController); |
| 341 visitor->trace(m_eventQueue); | 346 visitor->trace(m_eventQueue); |
| 342 visitor->trace(m_workerClients); | 347 visitor->trace(m_workerClients); |
| 343 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 348 WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| 344 ExecutionContext::trace(visitor); | 349 ExecutionContext::trace(visitor); |
| 345 EventTargetWithInlineData::trace(visitor); | 350 EventTargetWithInlineData::trace(visitor); |
| 346 } | 351 } |
| 347 | 352 |
| 348 } // namespace WebCore | 353 } // namespace WebCore |
| OLD | NEW |