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 079988459867da816e0fd266ccb4a654c867669c..415ed0ad1a8672d2b122125de68d992b839b9f4c 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,18 @@ bool EmbeddedWorkerInstance::Stop() { |
| return success; |
| } |
| +bool EmbeddedWorkerInstance::SendFetchRequest( |
| + const ServiceWorkerFetchRequest& request) { |
| + DCHECK(status_ == RUNNING); |
| + // Note to reviewers: the code around FetchEvent is very rough, it's here |
| + // basically to show how I'm planning to establish bidirectional channel |
| + // between embedded worker and browser. (I can remove this part from this |
| + // patch if this part looks too rough) |
|
alecflett
2013/12/19 00:59:11
I say leave it - this gives us something to build
kinuko
2013/12/20 08:01:09
Ok, changed it to a TODO comment
|
| + return registry_->Send(process_id_, |
| + new ServiceWorkerContextMsg_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 +81,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; |