Index: Source/core/workers/WorkerGlobalScope.cpp |
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp |
index a517c8704513d3fd0cbcb0632728b7eb664c560b..c52477d44365b678317c4a5f12afc34167a96601 100644 |
--- a/Source/core/workers/WorkerGlobalScope.cpp |
+++ b/Source/core/workers/WorkerGlobalScope.cpp |
@@ -92,12 +92,6 @@ 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); |
} |
void WorkerGlobalScope::applyContentSecurityPolicyFromString(const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) |
@@ -189,6 +183,20 @@ void WorkerGlobalScope::clearInspector() |
m_workerInspectorController.clear(); |
} |
+void WorkerGlobalScope::detach() |
+{ |
+ 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. |
+} |
+ |
void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState& exceptionState) |
{ |
ASSERT(contentSecurityPolicy()); |
@@ -280,4 +288,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 |