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 079988459867da816e0fd266ccb4a654c867669c..329b0073f211a90c0a86fc4c84a84141d4126002 100644 |
--- a/content/browser/service_worker/embedded_worker_instance.cc |
+++ b/content/browser/service_worker/embedded_worker_instance.cc |
@@ -5,12 +5,13 @@ |
#include "content/browser/service_worker/embedded_worker_instance.h" |
#include "content/browser/service_worker/embedded_worker_registry.h" |
+#include "content/common/service_worker_messages.h" |
#include "url/gurl.h" |
namespace content { |
EmbeddedWorkerInstance::~EmbeddedWorkerInstance() { |
- registry_->RemoveWorker(embedded_worker_id_); |
+ registry_->RemoveWorker(process_id_, embedded_worker_id_); |
} |
bool EmbeddedWorkerInstance::Start( |
@@ -40,6 +41,16 @@ bool EmbeddedWorkerInstance::Stop() { |
return success; |
} |
+bool EmbeddedWorkerInstance::SendFetchRequest( |
+ const ServiceWorkerFetchRequest& request) { |
+ DCHECK(status_ == RUNNING); |
+ // TODO: Refine this code, the code around FetchEvent is currently very |
+ // rough, mainly just for a placeholder for now. |
+ return registry_->Send(process_id_, |
+ new EmbeddedWorkerContextMsg_FetchEvent( |
+ thread_id_, embedded_worker_id_, request)); |
+} |
+ |
void EmbeddedWorkerInstance::AddProcessReference(int process_id) { |
ProcessRefMap::iterator found = process_refs_.find(process_id); |
if (found == process_refs_.end()) |
@@ -68,6 +79,9 @@ EmbeddedWorkerInstance::EmbeddedWorkerInstance( |
} |
void EmbeddedWorkerInstance::OnStarted(int thread_id) { |
+ // Stop is requested before OnStarted is sent back from the worker. |
+ if (status_ == STOPPING) |
+ return; |
DCHECK(status_ == STARTING); |
status_ = RUNNING; |
thread_id_ = thread_id; |