Index: content/browser/worker_host/worker_service_impl.h |
diff --git a/content/browser/worker_host/worker_service_impl.h b/content/browser/worker_host/worker_service_impl.h |
index 845f4334191b6124ba8da945e3f42b1303ed3f1b..670c86d7224762cd06a2f043fee7a5ee5e28600c 100644 |
--- a/content/browser/worker_host/worker_service_impl.h |
+++ b/content/browser/worker_host/worker_service_impl.h |
@@ -11,6 +11,7 @@ |
#include "base/observer_list.h" |
#include "base/threading/non_thread_safe.h" |
#include "content/browser/worker_host/worker_process_host.h" |
+#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/worker_service.h" |
@@ -23,11 +24,13 @@ class WorkerServiceObserver; |
class WorkerStoragePartition; |
class CONTENT_EXPORT WorkerServiceImpl |
- : public NON_EXPORTED_BASE(WorkerService) { |
+ : public NON_EXPORTED_BASE(WorkerService), |
+ public content::NotificationObserver { |
jam
2013/05/09 18:02:57
no "content::" since this is in the content namesp
shatch
2013/05/09 22:42:49
Done.
|
public: |
// Returns the WorkerServiceImpl singleton. |
static WorkerServiceImpl* GetInstance(); |
+ |
jam
2013/05/09 18:02:57
nit: remove
shatch
2013/05/09 22:42:49
Done.
|
// WorkerService implementation: |
virtual bool TerminateWorker(int process_id, int route_id) OVERRIDE; |
virtual std::vector<WorkerInfo> GetWorkers() OVERRIDE; |
@@ -72,6 +75,8 @@ class CONTENT_EXPORT WorkerServiceImpl |
WorkerProcessHost* process, |
int worker_route_id); |
+ void NotifyWorkerProcessCreated(); |
+ |
// Used when we run each worker in a separate process. |
static const int kMaxWorkersWhenSeparate; |
static const int kMaxWorkersPerTabWhenSeparate; |
@@ -122,6 +127,30 @@ class CONTENT_EXPORT WorkerServiceImpl |
const WorkerStoragePartition& worker_partition, |
ResourceContext* resource_context); |
+ // Registers as an observer to receive notifications about |
+ // widgets being shown. |
+ void RegisterObserver(); |
+ |
+ // Called to refresh worker priorities when focus changes between tabs. |
+ void OnRenderWidgetVisibilityChanged(std::pair<int, int>); |
+ |
+ // Sets priorities for shared workers given a set of visible tabs (as a |
+ // std::set of std::pair<render_process, render_view> ids. |
+ void UpdateWorkerPrioritiesFromVisibleSet( |
+ const std::set<std::pair<int, int> >* visible); |
+ |
+ // Gathers up a list of the visible tabs and then priorities for |
+ // all the shared workers. |
+ void GatherVisibleIDsAndUpdateWorkerPriorities(); |
+ |
+ // Posts a task to perform a worker priority update. |
+ void PostTaskToGatherAndUpdateWorkerPriorities(); |
+ |
+ // NotificationObserver implementation. |
+ virtual void Observe(int type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details) OVERRIDE; |
+ |
NotificationRegistrar registrar_; |
int next_worker_route_id_; |