#ifndef InspectorWorkerAgent_h
#define InspectorWorkerAgent_h
#include "core/inspector/InspectorBaseAgent.h"
#include "wtf/Forward.h"
#include "wtf/HashMap.h"
namespace WebCore {
class InspectorFrontend;
class InstrumentingAgents;
class JSONObject;
class KURL;
class WorkerGlobalScopeProxy;
typedef String ErrorString;
class InspectorWorkerAgent FINAL : public InspectorBaseAgent<InspectorWorkerAgent>, public InspectorBackendDispatcher::WorkerCommandHandler {
public:
static PassOwnPtr<InspectorWorkerAgent> create();
virtual ~InspectorWorkerAgent();
virtual void init() OVERRIDE;
virtual void setFrontend(InspectorFrontend*) OVERRIDE;
virtual void restore() OVERRIDE;
virtual void clearFrontend() OVERRIDE;
bool shouldPauseDedicatedWorkerOnStart();
void didStartWorkerGlobalScope(WorkerGlobalScopeProxy*, const KURL&);
void workerGlobalScopeTerminated(WorkerGlobalScopeProxy*);
virtual void enable(ErrorString*) OVERRIDE;
virtual void disable(ErrorString*) OVERRIDE;
virtual void canInspectWorkers(ErrorString*, bool*) OVERRIDE;
virtual void connectToWorker(ErrorString*, int workerId) OVERRIDE;
virtual void disconnectFromWorker(ErrorString*, int workerId) OVERRIDE;
virtual void sendMessageToWorker(ErrorString*, int workerId, const RefPtr<JSONObject>& message) OVERRIDE;
virtual void setAutoconnectToWorkers(ErrorString*, bool value) OVERRIDE;
private:
InspectorWorkerAgent();
void createWorkerFrontendChannelsForExistingWorkers();
void createWorkerFrontendChannel(WorkerGlobalScopeProxy*, const String& url);
void destroyWorkerFrontendChannels();
InspectorFrontend* m_inspectorFrontend;
class WorkerFrontendChannel;
typedef HashMap<int, WorkerFrontendChannel*> WorkerChannels;
WorkerChannels m_idToChannel;
typedef HashMap<WorkerGlobalScopeProxy*, String> DedicatedWorkers;
DedicatedWorkers m_dedicatedWorkers;
};
}
#endif