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

Unified Diff: content/worker/websharedworker_stub.cc

Issue 171943002: Don't terminate SharedWorker while loading the script. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | « content/worker/websharedworker_stub.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/worker/websharedworker_stub.cc
diff --git a/content/worker/websharedworker_stub.cc b/content/worker/websharedworker_stub.cc
index a2471df4a04783b8213ad403983d47297ce583fa..435c1dc1a58060b749fcf88eb6d666148a2bc449 100644
--- a/content/worker/websharedworker_stub.cc
+++ b/content/worker/websharedworker_stub.cc
@@ -27,6 +27,7 @@ WebSharedWorkerStub::WebSharedWorkerStub(
: route_id_(route_id),
client_(route_id, this),
running_(false),
+ terminating_(false),
url_(url) {
WorkerThread* worker_thread = WorkerThread::current();
@@ -102,15 +103,22 @@ void WebSharedWorkerStub::OnConnect(int sent_message_port_id, int routing_id) {
}
void WebSharedWorkerStub::OnTerminateWorkerContext() {
- impl_->terminateWorkerContext();
-
- // Call the client to make sure context exits.
- EnsureWorkerContextTerminates();
- running_ = false;
+ if (running_) {
+ impl_->terminateWorkerContext();
kinuko 2014/02/19 04:24:08 It feels like we should always nullify the impl_ a
horo 2014/02/19 05:29:09 The bug is caused by "delete this" in Shutdown() w
+ // Call the client to make sure context exits.
+ EnsureWorkerContextTerminates();
+ running_ = false;
+ } else {
+ terminating_ = true;
+ }
}
void WebSharedWorkerStub::WorkerScriptLoaded() {
running_ = true;
+ if (terminating_) {
+ OnTerminateWorkerContext();
+ return;
+ }
// Process any pending connections.
for (PendingChannelList::const_iterator iter = pending_channels_.begin();
iter != pending_channels_.end();
« no previous file with comments | « content/worker/websharedworker_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698