1 // Copyright (c) 2012 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.
5 #ifndef CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_
6 #define CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_
10 #include "base/process/process.h"
11 #include "content/common/content_export.h"
16 class WorkerServiceObserver
;
18 // A singleton for managing HTML5 shared web workers. These are run in a
19 // separate process, since multiple renderer processes can be talking to a
20 // single shared worker. All the methods below can only be called on the IO
24 virtual ~WorkerService() {}
26 // Returns the WorkerService singleton.
27 CONTENT_EXPORT
static WorkerService
* GetInstance();
29 // Terminates the given worker. Returns true if the process was found.
30 virtual bool TerminateWorker(int process_id
, int route_id
) = 0;
37 base::ProcessHandle handle
;
40 // Return information about all the currently running workers.
41 virtual std::vector
<WorkerInfo
> GetWorkers() = 0;
43 virtual void AddObserver(WorkerServiceObserver
* observer
) = 0;
44 virtual void RemoveObserver(WorkerServiceObserver
* observer
) = 0;
47 } // namespace content
49 #endif // CONTENT_PUBLIC_BROWSER_WORKER_SERVICE_H_