OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_WORKER_HOST__WORKER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_WORKER_HOST__WORKER_SERVICE_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/hash_tables.h" |
| 12 #include "base/singleton.h" |
| 13 #include "googleurl/src/gurl.h" |
| 14 |
| 15 namespace IPC { |
| 16 class Message; |
| 17 } |
| 18 |
| 19 class MessageLoop; |
| 20 class WorkerProcessHost; |
| 21 class ResourceMessageFilter; |
| 22 |
| 23 class WorkerService { |
| 24 public: |
| 25 // Returns the WorkerService singleton. |
| 26 static WorkerService* GetInstance(); |
| 27 |
| 28 // Creates a dedicated worker. Returns true on success. |
| 29 bool CreateDedicatedWorker(const GURL &url, |
| 30 ResourceMessageFilter* filter, |
| 31 int renderer_route_id); |
| 32 |
| 33 // Called by ResourceMessageFilter when a message from the renderer comes that |
| 34 // should be forwarded to the worker process. |
| 35 void ForwardMessage(const IPC::Message& message); |
| 36 |
| 37 // Called by ResourceMessageFilter when it's destructed so that all the |
| 38 // WorkerProcessHost objects can remove their pointers to it. |
| 39 void RendererShutdown(ResourceMessageFilter* filter); |
| 40 |
| 41 private: |
| 42 friend struct DefaultSingletonTraits<WorkerService>; |
| 43 |
| 44 WorkerService(); |
| 45 ~WorkerService(); |
| 46 |
| 47 int next_worker_route_id_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(WorkerService); |
| 50 }; |
| 51 |
| 52 #endif // CHROME_BROWSER_WORKER_HOST__WORKER_SERVICE_H_ |
OLD | NEW |