OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PUBLIC_BROWSER_WORKER_SERVICE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "base/process.h" |
9 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
10 | 13 |
| 14 class GURL; |
| 15 |
11 namespace content { | 16 namespace content { |
12 | 17 |
13 class WorkerServiceObserver; | 18 class WorkerServiceObserver; |
14 | 19 |
15 // A singleton for managing HTML5 shared web workers. These are run in a | 20 // A singleton for managing HTML5 shared web workers. These are run in a |
16 // separate process, since multiple renderer processes can be talking to a | 21 // separate process, since multiple renderer processes can be talking to a |
17 // single shared worker. | 22 // single shared worker. All the methods below can only be called on the IO |
| 23 // thread. |
18 class WorkerService { | 24 class WorkerService { |
19 public: | 25 public: |
20 virtual ~WorkerService() {} | 26 virtual ~WorkerService() {} |
21 | 27 |
22 // Returns the WorkerService singleton. | 28 // Returns the WorkerService singleton. |
23 CONTENT_EXPORT static WorkerService* GetInstance(); | 29 CONTENT_EXPORT static WorkerService* GetInstance(); |
24 | 30 |
| 31 // Terminates the given worker. Returns true if the process was found. |
| 32 virtual bool TerminateWorker(int process_id, int route_id) = 0; |
| 33 |
| 34 struct WorkerInfo { |
| 35 GURL url; |
| 36 string16 name; |
| 37 int process_id; |
| 38 int route_id; |
| 39 base::ProcessHandle handle; |
| 40 }; |
| 41 |
| 42 // Return information about all the currently running workers. |
| 43 virtual std::vector<WorkerInfo> GetWorkers() = 0; |
| 44 |
25 virtual void AddObserver(WorkerServiceObserver* observer) = 0; | 45 virtual void AddObserver(WorkerServiceObserver* observer) = 0; |
26 virtual void RemoveObserver(WorkerServiceObserver* observer) = 0; | 46 virtual void RemoveObserver(WorkerServiceObserver* observer) = 0; |
27 }; | 47 }; |
28 | 48 |
29 } // namespace content | 49 } // namespace content |
30 | 50 |
31 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ | 51 #endif // CONTENT_PUBLIC_BROWSER_PLUGIN_SERVICE_H_ |
OLD | NEW |