Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1597)

Unified Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 1111693003: Remove the concept of a cleanup task (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ASSERT => ASSERT_UNUSED Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/workers/WorkerGlobalScope.cpp
diff --git a/Source/core/workers/WorkerGlobalScope.cpp b/Source/core/workers/WorkerGlobalScope.cpp
index 48280c3525443f8add1f77792d20956b4acefca2..892f041214dbb73145cf97cb98515f49e2d161e6 100644
--- a/Source/core/workers/WorkerGlobalScope.cpp
+++ b/Source/core/workers/WorkerGlobalScope.cpp
@@ -68,23 +68,6 @@
namespace blink {
-class CloseWorkerGlobalScopeTask : public ExecutionContextTask {
-public:
- static PassOwnPtr<CloseWorkerGlobalScopeTask> create()
- {
- return adoptPtr(new CloseWorkerGlobalScopeTask);
- }
-
- virtual void performTask(ExecutionContext *context)
- {
- WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
- // Notify parent that this context is closed. Parent is responsible for calling WorkerThread::stop().
- workerGlobalScope->thread()->workerReportingProxy().workerGlobalScopeClosed();
- }
-
- virtual bool isCleanupTask() const { return true; }
-};
-
WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, const SecurityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
: m_url(url)
, m_userAgent(userAgent)
@@ -176,14 +159,8 @@ WorkerLocation* WorkerGlobalScope::location() const
void WorkerGlobalScope::close()
haraken 2015/05/09 15:54:36 I'm just curious if we can add ASSERT(!m_closing)
Sami 2015/05/11 10:35:32 Correct me if I'm wrong but I think a worker scrip
{
- if (m_closing)
- return;
-
- // Let current script run to completion but prevent future script evaluations.
- // After m_closing is set, all the tasks in the queue continue to be fetched but only
- // tasks with isCleanupTask()==true will be executed.
+ // Let current script run to completion, but tell the worker thread to shut down after the script exits.
haraken 2015/05/09 15:54:36 This comment looks out-dated. We no longer tell th
Sami 2015/05/11 10:35:32 Right, I've now tried to make it a little more acc
m_closing = true;
- postTask(FROM_HERE, CloseWorkerGlobalScopeTask::create());
}
WorkerConsole* WorkerGlobalScope::console()
@@ -216,6 +193,11 @@ void WorkerGlobalScope::clearInspector()
void WorkerGlobalScope::dispose()
{
ASSERT(thread()->isCurrentThread());
+ stopActiveDOMObjects();
+
+ // Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects,
+ // which become dangling once Heap is destroyed.
+ removeAllEventListeners();
clearScript();
clearInspector();

Powered by Google App Engine
This is Rietveld 408576698