Chromium Code Reviews| Index: Source/core/workers/WorkerGlobalScope.cpp |
| diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp |
| index d0f3064a5060c908f073f80a5992341dbbdd197d..e273691d3451995df34b6a969105be18446cd214 100644 |
| --- a/Source/core/workers/WorkerGlobalScope.cpp |
| +++ b/Source/core/workers/WorkerGlobalScope.cpp |
| @@ -93,12 +93,9 @@ WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, W |
| WorkerGlobalScope::~WorkerGlobalScope() |
| { |
| - ASSERT(thread()->isCurrentThread()); |
| - |
| - // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this. |
| - thread()->workerReportingProxy().workerGlobalScopeDestroyed(); |
| - |
| - setClient(0); |
| +#if !ENABLE(OILPAN) |
| + dispose(); |
| +#endif |
| } |
| void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicyHeaderType contentSecurityPolicyType) |
| @@ -190,6 +187,20 @@ void WorkerGlobalScope::clearInspector() |
| m_workerInspectorController.clear(); |
| } |
| +void WorkerGlobalScope::dispose() |
| +{ |
| + ASSERT(thread()->isCurrentThread()); |
| + |
| + // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this. |
| + thread()->workerReportingProxy().workerGlobalScopeDestroyed(); |
| + |
| + clearScript(); |
| + clearInspector(); |
| + setClient(0); |
| + // NOTE: the thread reference isn't cleared, as the execution context's |
| + // thread is accessed by other GCed objects being finalized/destructed. |
|
haraken
2014/03/10 07:10:03
Thanks sof for the clarification! Now I think this
Mads Ager (chromium)
2014/03/10 08:51:14
Is the issue here that lifecycle observers will ac
|
| +} |
| + |
| void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState& exceptionState) |
| { |
| ASSERT(contentSecurityPolicy()); |
| @@ -281,4 +292,12 @@ WorkerEventQueue* WorkerGlobalScope::eventQueue() const |
| return m_eventQueue.get(); |
| } |
| +void WorkerGlobalScope::trace(Visitor* visitor) |
| +{ |
| + visitor->trace(m_console); |
| + visitor->trace(m_location); |
| + visitor->trace(m_navigator); |
| + WillBeHeapSupplementable<WorkerGlobalScope>::trace(visitor); |
| +} |
| + |
| } // namespace WebCore |