#ifndef CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
#define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
#include "base/basictypes.h"
#include "base/id_map.h"
#include "base/memory/weak_ptr.h"
#include "ipc/ipc_listener.h"
struct ServiceWorkerMsg_StartWorker_Params;
class GURL;
namespace WebKit {
class WebEmbeddedWorker;
}
namespace content {
class EmbeddedWorkerDispatcher : public IPC::Listener {
public:
EmbeddedWorkerDispatcher();
virtual ~EmbeddedWorkerDispatcher();
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
void WorkerContextDestroyed(int embedded_worker_id);
private:
class WorkerWrapper;
void OnStartWorker(int embedded_worker_id,
int64 service_worker_version_id,
const GURL& script_url);
void OnStopWorker(int embedded_worker_id);
IDMap<WorkerWrapper, IDMapOwnPointer> workers_;
base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher);
};
}
#endif