Chromium Code Reviews| 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 152afd12849bb70cc9325bfc2ca41950c775cb67..8c7f9e2cfee5c655969bf737f6b7a02127f91437 100644 |
| --- a/content/browser/service_worker/embedded_worker_instance.cc |
| +++ b/content/browser/service_worker/embedded_worker_instance.cc |
| @@ -171,7 +171,9 @@ void EmbeddedWorkerInstance::ResumeAfterDownload() { |
| ServiceWorkerStatusCode EmbeddedWorkerInstance::SendMessage( |
| const IPC::Message& message) { |
| - DCHECK(status_ == RUNNING); |
| + DCHECK_NE(-1, thread_id_); |
|
dominicc (has gone to gerrit)
2014/08/21 04:04:23
kInvalidThreadId or something grepable for this?
|
| + if (status_ != RUNNING && status_ != STARTING) |
| + return SERVICE_WORKER_ERROR_IPC_FAILED; |
| return registry_->Send(process_id_, |
| new EmbeddedWorkerContextMsg_MessageToWorker( |
| thread_id_, embedded_worker_id_, message)); |
| @@ -274,7 +276,8 @@ void EmbeddedWorkerInstance::OnReadyForInspection() { |
| worker_devtools_agent_route_id_); |
| } |
| -void EmbeddedWorkerInstance::OnScriptLoaded() { |
| +void EmbeddedWorkerInstance::OnScriptLoaded(int thread_id) { |
| + thread_id_ = thread_id; |
| if (worker_devtools_agent_route_id_ != MSG_ROUTING_NONE) |
| NotifyWorkerContextStarted(process_id_, worker_devtools_agent_route_id_); |
| } |
| @@ -282,13 +285,12 @@ void EmbeddedWorkerInstance::OnScriptLoaded() { |
| void EmbeddedWorkerInstance::OnScriptLoadFailed() { |
| } |
| -void EmbeddedWorkerInstance::OnStarted(int thread_id) { |
| +void EmbeddedWorkerInstance::OnStarted() { |
| // Stop is requested before OnStarted is sent back from the worker. |
| if (status_ == STOPPING) |
| return; |
| DCHECK(status_ == STARTING); |
| status_ = RUNNING; |
| - thread_id_ = thread_id; |
| FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); |
| } |