OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // WorkerService implementation: | 30 // WorkerService implementation: |
31 virtual bool TerminateWorker(int process_id, int route_id) OVERRIDE; | 31 virtual bool TerminateWorker(int process_id, int route_id) OVERRIDE; |
32 virtual std::vector<WorkerInfo> GetWorkers() OVERRIDE; | 32 virtual std::vector<WorkerInfo> GetWorkers() OVERRIDE; |
33 virtual void AddObserver(WorkerServiceObserver* observer) OVERRIDE; | 33 virtual void AddObserver(WorkerServiceObserver* observer) OVERRIDE; |
34 virtual void RemoveObserver(WorkerServiceObserver* observer) OVERRIDE; | 34 virtual void RemoveObserver(WorkerServiceObserver* observer) OVERRIDE; |
35 | 35 |
36 // These methods correspond to worker related IPCs. | 36 // These methods correspond to worker related IPCs. |
37 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, | 37 void CreateWorker(const ViewHostMsg_CreateWorker_Params& params, |
38 int route_id, | 38 int route_id, |
39 WorkerMessageFilter* filter, | 39 WorkerMessageFilter* filter, |
40 ResourceContext* resource_context); | 40 ResourceContext* resource_context, |
| 41 StoragePartitionImpl* storage_partition); |
41 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, | 42 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, |
42 int route_id, | 43 int route_id, |
43 WorkerMessageFilter* filter, | 44 WorkerMessageFilter* filter, |
44 ResourceContext* resource_context, | 45 ResourceContext* resource_context, |
| 46 StoragePartitionImpl* storage_partition, |
45 bool* exists, | 47 bool* exists, |
46 bool* url_error); | 48 bool* url_error); |
47 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); | 49 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); |
48 void ForwardToWorker(const IPC::Message& message, | 50 void ForwardToWorker(const IPC::Message& message, |
49 WorkerMessageFilter* filter); | 51 WorkerMessageFilter* filter); |
50 void DocumentDetached(unsigned long long document_id, | 52 void DocumentDetached(unsigned long long document_id, |
51 WorkerMessageFilter* filter); | 53 WorkerMessageFilter* filter); |
52 | 54 |
53 void OnWorkerMessageFilterClosing(WorkerMessageFilter* filter); | 55 void OnWorkerMessageFilterClosing(WorkerMessageFilter* filter); |
54 | 56 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bool TabCanCreateWorkerProcess( | 110 bool TabCanCreateWorkerProcess( |
109 int render_process_id, int render_route_id, bool* hit_total_worker_limit); | 111 int render_process_id, int render_route_id, bool* hit_total_worker_limit); |
110 | 112 |
111 // Tries to see if any of the queued workers can be created. | 113 // Tries to see if any of the queued workers can be created. |
112 void TryStartingQueuedWorker(); | 114 void TryStartingQueuedWorker(); |
113 | 115 |
114 // APIs for manipulating our set of pending shared worker instances. | 116 // APIs for manipulating our set of pending shared worker instances. |
115 WorkerProcessHost::WorkerInstance* CreatePendingInstance( | 117 WorkerProcessHost::WorkerInstance* CreatePendingInstance( |
116 const GURL& url, | 118 const GURL& url, |
117 const string16& name, | 119 const string16& name, |
118 ResourceContext* resource_context); | 120 ResourceContext* resource_context, |
| 121 StoragePartitionImpl* storage_partition); |
119 WorkerProcessHost::WorkerInstance* FindPendingInstance( | 122 WorkerProcessHost::WorkerInstance* FindPendingInstance( |
120 const GURL& url, | 123 const GURL& url, |
121 const string16& name, | 124 const string16& name, |
122 ResourceContext* resource_context); | 125 ResourceContext* resource_context, |
| 126 StoragePartitionImpl* storage_partition); |
123 void RemovePendingInstances( | 127 void RemovePendingInstances( |
124 const GURL& url, | 128 const GURL& url, |
125 const string16& name, | 129 const string16& name, |
126 ResourceContext* resource_context); | 130 ResourceContext* resource_context, |
| 131 StoragePartitionImpl* storage_partition); |
127 | 132 |
128 WorkerProcessHost::WorkerInstance* FindSharedWorkerInstance( | 133 WorkerProcessHost::WorkerInstance* FindSharedWorkerInstance( |
129 const GURL& url, | 134 const GURL& url, |
130 const string16& name, | 135 const string16& name, |
131 ResourceContext* resource_context); | 136 ResourceContext* resource_context, |
| 137 StoragePartitionImpl* storage_partition); |
132 | 138 |
133 NotificationRegistrar registrar_; | 139 NotificationRegistrar registrar_; |
134 int next_worker_route_id_; | 140 int next_worker_route_id_; |
135 | 141 |
136 WorkerProcessHost::Instances queued_workers_; | 142 WorkerProcessHost::Instances queued_workers_; |
137 | 143 |
138 // These are shared workers that have been looked up, but not created yet. | 144 // These are shared workers that have been looked up, but not created yet. |
139 // We need to keep a list of these to synchronously detect shared worker | 145 // We need to keep a list of these to synchronously detect shared worker |
140 // URL mismatches when two pages launch shared workers simultaneously. | 146 // URL mismatches when two pages launch shared workers simultaneously. |
141 WorkerProcessHost::Instances pending_shared_workers_; | 147 WorkerProcessHost::Instances pending_shared_workers_; |
142 | 148 |
143 ObserverList<WorkerServiceObserver> observers_; | 149 ObserverList<WorkerServiceObserver> observers_; |
144 | 150 |
145 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); | 151 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); |
146 }; | 152 }; |
147 | 153 |
148 } // namespace content | 154 } // namespace content |
149 | 155 |
150 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 156 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
OLD | NEW |