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

Unified Diff: webkit/glue/webworker_impl.cc

Issue 151125: Fix the GC of workers. When Worker object is GC'ed in the renderer, we need t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« no previous file with comments | « webkit/glue/webworker_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webworker_impl.cc
===================================================================
--- webkit/glue/webworker_impl.cc (revision 19506)
+++ webkit/glue/webworker_impl.cc (working copy)
@@ -117,7 +117,8 @@
WebWorkerImpl::WebWorkerImpl(WebWorkerClient* client)
: client_(client),
- web_view_(NULL) {
+ web_view_(NULL),
+ asked_to_terminate_(false) {
InitializeWebKitStaticValues();
}
@@ -184,6 +185,10 @@
}
void WebWorkerImpl::terminateWorkerContext() {
+ if (asked_to_terminate_)
+ return;
+ asked_to_terminate_ = true;
+
if (worker_thread_)
worker_thread_->stop();
}
@@ -196,6 +201,11 @@
}
void WebWorkerImpl::workerObjectDestroyed() {
+ // Worker object in the renderer was destroyed, perhaps a result of GC.
+ // For us, it's a signal to start terminating the WorkerContext too.
+ // TODO(dimich): when 'kill a worker' html5 spec algorithm is implemented, it
+ // should be used here instead of 'terminate a worker'.
+ terminateWorkerContext();
}
void WebWorkerImpl::DispatchTaskToMainThread(
« no previous file with comments | « webkit/glue/webworker_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698