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_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| 7 |
| 8 #include <list> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/common/child_process_host.h" |
| 13 #include "chrome/common/ipc_channel.h" |
| 14 #include "googleurl/src/gurl.h" |
| 15 |
| 16 class ResourceMessageFilter; |
| 17 |
| 18 class WorkerProcessHost : public ChildProcessHost { |
| 19 public: |
| 20 WorkerProcessHost(MessageLoop* main_message_loop); |
| 21 ~WorkerProcessHost(); |
| 22 |
| 23 // Starts the process. Returns true iff it succeeded. |
| 24 bool Init(); |
| 25 |
| 26 // Creates a worker object in the process. |
| 27 void CreateWorker(const GURL& url, |
| 28 int worker_route_id, |
| 29 int renderer_route_id, |
| 30 ResourceMessageFilter* filter); |
| 31 |
| 32 // Returns true iff the given message from a renderer process was forwarded to |
| 33 // the worker. |
| 34 bool FilterMessage(const IPC::Message& message); |
| 35 |
| 36 void RendererShutdown(ResourceMessageFilter* filter); |
| 37 |
| 38 private: |
| 39 // Called when a message arrives from the worker process. |
| 40 void OnMessageReceived(const IPC::Message& message); |
| 41 |
| 42 // Contains information about each worker instance, needed to forward messages |
| 43 // between the renderer and worker processes. |
| 44 struct WorkerInstance { |
| 45 int worker_route_id; |
| 46 int renderer_route_id; |
| 47 ResourceMessageFilter* filter; |
| 48 }; |
| 49 |
| 50 typedef std::list<WorkerInstance> Instances; |
| 51 Instances instances_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
OLD | NEW |