| 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_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_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 EmbeddedWorkerMsg_StartWorker_Params; | 13 struct EmbeddedWorkerMsg_StartWorker_Params; |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace WebKit { | |
| 17 class WebEmbeddedWorker; | |
| 18 } | |
| 19 | |
| 20 namespace content { | 16 namespace content { |
| 21 | 17 |
| 22 // A tiny dispatcher which handles embedded worker start/stop messages. | 18 // A tiny dispatcher which handles embedded worker start/stop messages. |
| 23 class EmbeddedWorkerDispatcher : public IPC::Listener { | 19 class EmbeddedWorkerDispatcher : public IPC::Listener { |
| 24 public: | 20 public: |
| 25 EmbeddedWorkerDispatcher(); | 21 EmbeddedWorkerDispatcher(); |
| 26 ~EmbeddedWorkerDispatcher() override; | 22 ~EmbeddedWorkerDispatcher() override; |
| 27 | 23 |
| 28 // IPC::Listener overrides. | 24 // IPC::Listener overrides. |
| 29 bool OnMessageReceived(const IPC::Message& message) override; | 25 bool OnMessageReceived(const IPC::Message& message) override; |
| 30 | 26 |
| 31 void WorkerContextDestroyed(int embedded_worker_id); | 27 void WorkerContextDestroyed(int embedded_worker_id); |
| 32 | 28 |
| 33 private: | 29 private: |
| 34 class WorkerWrapper; | 30 class WorkerWrapper; |
| 35 | 31 |
| 36 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params); | 32 void OnStartWorker(const EmbeddedWorkerMsg_StartWorker_Params& params); |
| 37 void OnStopWorker(int embedded_worker_id); | 33 void OnStopWorker(int embedded_worker_id); |
| 38 void OnResumeAfterDownload(int embedded_worker_id); | 34 void OnResumeAfterDownload(int embedded_worker_id); |
| 39 | 35 |
| 40 IDMap<WorkerWrapper, IDMapOwnPointer> workers_; | 36 IDMap<WorkerWrapper, IDMapOwnPointer> workers_; |
| 41 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; | 37 base::WeakPtrFactory<EmbeddedWorkerDispatcher> weak_factory_; |
| 42 | 38 |
| 43 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); | 39 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDispatcher); |
| 44 }; | 40 }; |
| 45 | 41 |
| 46 } // namespace content | 42 } // namespace content |
| 47 | 43 |
| 48 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ | 44 #endif // CONTENT_RENDERER_SERVICE_WORKER_EMBEDDED_WORKER_DISPATCHER_H_ |
| OLD | NEW |