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

Unified Diff: content/browser/service_worker/embedded_worker_instance.cc

Issue 118103002: Add IPC stubs between browser and ServiceWorker's worker context in the child process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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;

Powered by Google App Engine
This is Rietveld 408576698