Index: content/browser/service_worker/embedded_worker_instance.cc |
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc |
index dcf7580597bc687029169a2ba30cc41139c05a63..8a980ef3db305d61eb9b2a993058782769b0a026 100644 |
--- a/content/browser/service_worker/embedded_worker_instance.cc |
+++ b/content/browser/service_worker/embedded_worker_instance.cc |
@@ -813,6 +813,11 @@ void EmbeddedWorkerInstance::OnDetached() { |
} |
void EmbeddedWorkerInstance::Detach() { |
+ // This could be called on the UI thread if |client_| still be valid when the |
+ // message loop on the UI thread gets destructed. |
nhiroki
2016/11/02 07:59:50
Making an indirection could be saner than directly
horo
2016/11/02 08:22:54
+1
|
+ // TODO(shimazu): Remove this after https://crbug.com/604762 is fixed |
+ if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) |
+ return; |
horo
2016/11/02 07:49:12
Please add DCHECK for mojo sw.
if (!BrowserThread
|
registry_->DetachWorker(process_id(), embedded_worker_id()); |
OnDetached(); |
} |