| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 73     } | 73     } | 
| 74 | 74 | 
| 75     virtual bool isCleanupTask() const { return true; } | 75     virtual bool isCleanupTask() const { return true; } | 
| 76 }; | 76 }; | 
| 77 | 77 | 
| 78 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
     orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo
     rkerClients) | 78 WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W
     orkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> wo
     rkerClients) | 
| 79     : m_url(url) | 79     : m_url(url) | 
| 80     , m_userAgent(userAgent) | 80     , m_userAgent(userAgent) | 
| 81     , m_script(adoptPtr(new WorkerScriptController(*this))) | 81     , m_script(adoptPtr(new WorkerScriptController(*this))) | 
| 82     , m_thread(thread) | 82     , m_thread(thread) | 
| 83     , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this))) | 83     , m_workerInspectorController(adoptPtrWillBeNoop(new WorkerInspectorControll
     er(this))) | 
| 84     , m_closing(false) | 84     , m_closing(false) | 
| 85     , m_eventQueue(WorkerEventQueue::create(this)) | 85     , m_eventQueue(WorkerEventQueue::create(this)) | 
| 86     , m_workerClients(workerClients) | 86     , m_workerClients(workerClients) | 
| 87     , m_timeOrigin(timeOrigin) | 87     , m_timeOrigin(timeOrigin) | 
| 88     , m_terminationObserver(0) | 88     , m_terminationObserver(0) | 
| 89 { | 89 { | 
| 90     ScriptWrappable::init(this); | 90     ScriptWrappable::init(this); | 
| 91     setClient(this); | 91     setClient(this); | 
| 92     setSecurityOrigin(SecurityOrigin::create(url)); | 92     setSecurityOrigin(SecurityOrigin::create(url)); | 
| 93     m_workerClients->reattachThread(); | 93     m_workerClients->reattachThread(); | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 174     if (!m_navigator) | 174     if (!m_navigator) | 
| 175         m_navigator = WorkerNavigator::create(m_userAgent); | 175         m_navigator = WorkerNavigator::create(m_userAgent); | 
| 176     return m_navigator.get(); | 176     return m_navigator.get(); | 
| 177 } | 177 } | 
| 178 | 178 | 
| 179 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) | 179 void WorkerGlobalScope::postTask(PassOwnPtr<ExecutionContextTask> task) | 
| 180 { | 180 { | 
| 181     thread()->runLoop().postTask(task); | 181     thread()->runLoop().postTask(task); | 
| 182 } | 182 } | 
| 183 | 183 | 
|  | 184 // FIXME: Called twice, from WorkerThreadShutdownFinishTask and WorkerGlobalScop
     e::dispose. | 
| 184 void WorkerGlobalScope::clearInspector() | 185 void WorkerGlobalScope::clearInspector() | 
| 185 { | 186 { | 
|  | 187     if (!m_workerInspectorController) | 
|  | 188         return; | 
|  | 189     m_workerInspectorController->dispose(); | 
| 186     m_workerInspectorController.clear(); | 190     m_workerInspectorController.clear(); | 
| 187 } | 191 } | 
| 188 | 192 | 
| 189 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe
     r) | 193 void WorkerGlobalScope::registerTerminationObserver(TerminationObserver* observe
     r) | 
| 190 { | 194 { | 
| 191     ASSERT(!m_terminationObserver); | 195     ASSERT(!m_terminationObserver); | 
| 192     ASSERT(observer); | 196     ASSERT(observer); | 
| 193     m_terminationObserver = observer; | 197     m_terminationObserver = observer; | 
| 194 } | 198 } | 
| 195 | 199 | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 320 WorkerEventQueue* WorkerGlobalScope::eventQueue() const | 324 WorkerEventQueue* WorkerGlobalScope::eventQueue() const | 
| 321 { | 325 { | 
| 322     return m_eventQueue.get(); | 326     return m_eventQueue.get(); | 
| 323 } | 327 } | 
| 324 | 328 | 
| 325 void WorkerGlobalScope::trace(Visitor* visitor) | 329 void WorkerGlobalScope::trace(Visitor* visitor) | 
| 326 { | 330 { | 
| 327     visitor->trace(m_console); | 331     visitor->trace(m_console); | 
| 328     visitor->trace(m_location); | 332     visitor->trace(m_location); | 
| 329     visitor->trace(m_navigator); | 333     visitor->trace(m_navigator); | 
|  | 334     visitor->trace(m_workerInspectorController); | 
| 330     visitor->trace(m_eventQueue); | 335     visitor->trace(m_eventQueue); | 
| 331     visitor->trace(m_workerClients); | 336     visitor->trace(m_workerClients); | 
| 332     WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 337     WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); | 
| 333     ExecutionContext::trace(visitor); | 338     ExecutionContext::trace(visitor); | 
| 334     EventTargetWithInlineData::trace(visitor); | 339     EventTargetWithInlineData::trace(visitor); | 
| 335 } | 340 } | 
| 336 | 341 | 
| 337 } // namespace WebCore | 342 } // namespace WebCore | 
| OLD | NEW | 
|---|