| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 6 #define CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "ipc/ipc_listener.h" | 11 #include "ipc/ipc_listener.h" |
| 12 | 12 |
| 13 struct ServiceWorkerMsg_StartWorker_Params; | 13 struct EmbeddedWorkerMsg_StartWorker_Params; |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace WebKit { | 16 namespace WebKit { |
| 17 class WebEmbeddedWorker; | 17 class WebEmbeddedWorker; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 // A tiny dispatcher which handles embedded worker start/stop messages. | 22 // A tiny dispatcher which handles embedded worker start/stop messages. |
| 23 class EmbeddedWorkerDispatcher : public IPC::Listener { | 23 class EmbeddedWorkerDispatcher : public IPC::Listener { |
| 24 public: | 24 public: |
| 25 EmbeddedWorkerDispatcher(); | 25 EmbeddedWorkerDispatcher(); |
| 26 virtual ~EmbeddedWorkerDispatcher(); | 26 virtual ~EmbeddedWorkerDispatcher(); |
| 27 | 27 |
| 28 // IPC::Listener overrides. | 28 // IPC::Listener overrides. |
| 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 30 | 30 |
| 31 void WorkerContextDestroyed(int embedded_worker_id); | 31 void WorkerContextDestroyed(int embedded_worker_id); |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 class WorkerWrapper; | 34 class WorkerWrapper; |
| 35 | 35 |
| 36 void OnStartWorker(int embedded_worker_id, | 36 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params); |
| 37 int64 service_worker_version_id, | |
| 38 const GURL& service_worker_scope, | |
| 39 const GURL& script_url); | |
| 40 void OnStopWorker(int embedded_worker_id); | 37 void OnStopWorker(int embedded_worker_id); |
| 41 | 38 |
| 42 IDMap<WorkerWrapper, IDMapOwnPointer> workers_; | 39 IDMap<WorkerWrapper, IDMapOwnPointer> workers_; |
| 43 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; | 40 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; |
| 44 | 41 |
| 45 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); | 42 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); |
| 46 }; | 43 }; |
| 47 | 44 |
| 48 } // namespace content | 45 } // namespace content |
| 49 | 46 |
| 50 #endif // CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 47 #endif // CONTENT_CHILD_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
| OLD | NEW |