Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / service_worker / embedded_worker_dispatcher.h
blobcdb07e0feb1f4da4c77792b8c445eac851aa563b
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_
8 #include "base/basictypes.h"
9 #include "base/id_map.h"
10 #include "base/memory/weak_ptr.h"
11 #include "ipc/ipc_listener.h"
13 struct EmbeddedWorkerMsg_StartWorker_Params;
14 class GURL;
16 namespace WebKit {
17 class WebEmbeddedWorker;
20 namespace content {
22 // A tiny dispatcher which handles embedded worker start/stop messages.
23 class EmbeddedWorkerDispatcher : public IPC::Listener {
24 public:
25 EmbeddedWorkerDispatcher();
26 virtual ~EmbeddedWorkerDispatcher();
28 // IPC::Listener overrides.
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
31 void WorkerContextDestroyed(int embedded_worker_id);
33 private:
34 class WorkerWrapper;
36 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params);
37 void OnStopWorker(int embedded_worker_id);
38 void OnResumeAfterDownload(int embedded_worker_id);
40 IDMap<WorkerWrapper, IDMapOwnPointer> workers_;
41 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_;
43 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher);
46 } // namespace content
48 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_