| Index: content/browser/service_worker/embedded_worker_instance.h
|
| diff --git a/content/browser/service_worker/embedded_worker_instance.h b/content/browser/service_worker/embedded_worker_instance.h
|
| index f9d382c27748f208785ccf7bbe00f62f1f5ed4c5..952fb8ae611358bf2f9add2ff2c07dd09b9e1f49 100644
|
| --- a/content/browser/service_worker/embedded_worker_instance.h
|
| +++ b/content/browser/service_worker/embedded_worker_instance.h
|
| @@ -13,12 +13,14 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/observer_list.h"
|
| #include "base/strings/string16.h"
|
| #include "content/common/content_export.h"
|
| #include "content/common/service_worker/service_worker_status_code.h"
|
| +#include "url/gurl.h"
|
|
|
| -class GURL;
|
| +struct EmbeddedWorkerMsg_StartWorker_Params;
|
|
|
| namespace IPC {
|
| class Message;
|
| @@ -27,6 +29,7 @@ class Message;
|
| namespace content {
|
|
|
| class EmbeddedWorkerRegistry;
|
| +class ServiceWorkerContextCore;
|
| struct ServiceWorkerFetchRequest;
|
|
|
| // This gives an interface to control one EmbeddedWorker instance, which
|
| @@ -94,9 +97,6 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
|
| Status status() const { return status_; }
|
| int process_id() const { return process_id_; }
|
| int thread_id() const { return thread_id_; }
|
| - int worker_devtools_agent_route_id() const {
|
| - return worker_devtools_agent_route_id_;
|
| - }
|
|
|
| void AddListener(Listener* listener);
|
| void RemoveListener(Listener* listener);
|
| @@ -111,14 +111,28 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
|
|
|
| // Constructor is called via EmbeddedWorkerRegistry::CreateWorker().
|
| // This instance holds a ref of |registry|.
|
| - EmbeddedWorkerInstance(EmbeddedWorkerRegistry* registry,
|
| + EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context,
|
| int embedded_worker_id);
|
|
|
| - // Called back from EmbeddedWorkerRegistry after Start() passes control to the
|
| - // UI thread to acquire a reference to the process.
|
| - void RecordProcessId(int process_id,
|
| - ServiceWorkerStatusCode status,
|
| - int worker_devtools_agent_route_id);
|
| + // Called back from ServiceWorkerProcessManager after Start() passes control
|
| + // to the UI thread to acquire a reference to the process.
|
| + static void RunProcessAllocated(
|
| + base::WeakPtr<EmbeddedWorkerInstance> instance,
|
| + base::WeakPtr<ServiceWorkerContextCore> context,
|
| + scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params,
|
| + const EmbeddedWorkerInstance::StatusCallback& callback,
|
| + ServiceWorkerStatusCode status,
|
| + int process_id);
|
| + void ProcessAllocated(scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params,
|
| + const StatusCallback& callback,
|
| + int process_id,
|
| + ServiceWorkerStatusCode status);
|
| + // Called back after ProcessAllocated() passes control to the UI thread to
|
| + // register to WorkerDevToolsManager.
|
| + void SendStartWorker(scoped_ptr<EmbeddedWorkerMsg_StartWorker_Params> params,
|
| + const StatusCallback& callback,
|
| + int worker_devtools_agent_route_id,
|
| + bool pause_on_start);
|
|
|
| // Called back from Registry when the worker instance has ack'ed that
|
| // it finished loading the script.
|
| @@ -163,6 +177,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
|
| std::vector<int> SortProcesses(
|
| const std::vector<int>& possible_process_ids) const;
|
|
|
| + base::WeakPtr<ServiceWorkerContextCore> context_;
|
| scoped_refptr<EmbeddedWorkerRegistry> registry_;
|
| const int embedded_worker_id_;
|
| Status status_;
|
| @@ -175,6 +190,8 @@ class CONTENT_EXPORT EmbeddedWorkerInstance {
|
| ProcessRefMap process_refs_;
|
| ListenerList listener_list_;
|
|
|
| + base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance);
|
| };
|
|
|
|
|