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 const std::string& partition_id, |
| 41 ResourceContext* resource_context, |
| 42 ChromeAppCacheService* appcache_service, |
| 43 fileapi::FileSystemContext* filesystem_context, |
| 44 webkit_database::DatabaseTracker* database_tracker, |
| 45 IndexedDBContextImpl* indexed_db_context); |
41 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, | 46 void LookupSharedWorker(const ViewHostMsg_CreateWorker_Params& params, |
42 int route_id, | 47 int route_id, |
43 WorkerMessageFilter* filter, | 48 WorkerMessageFilter* filter, |
| 49 const std::string& partition_id, |
44 ResourceContext* resource_context, | 50 ResourceContext* resource_context, |
| 51 ChromeAppCacheService* appcache_service, |
| 52 fileapi::FileSystemContext* filesystem_context, |
| 53 webkit_database::DatabaseTracker* database_tracker, |
| 54 IndexedDBContextImpl* indexed_db_context, |
45 bool* exists, | 55 bool* exists, |
46 bool* url_error); | 56 bool* url_error); |
47 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); | 57 void CancelCreateDedicatedWorker(int route_id, WorkerMessageFilter* filter); |
48 void ForwardToWorker(const IPC::Message& message, | 58 void ForwardToWorker(const IPC::Message& message, |
49 WorkerMessageFilter* filter); | 59 WorkerMessageFilter* filter); |
50 void DocumentDetached(unsigned long long document_id, | 60 void DocumentDetached(unsigned long long document_id, |
51 WorkerMessageFilter* filter); | 61 WorkerMessageFilter* filter); |
52 | 62 |
53 void OnWorkerMessageFilterClosing(WorkerMessageFilter* filter); | 63 void OnWorkerMessageFilterClosing(WorkerMessageFilter* filter); |
54 | 64 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bool TabCanCreateWorkerProcess( | 118 bool TabCanCreateWorkerProcess( |
109 int render_process_id, int render_route_id, bool* hit_total_worker_limit); | 119 int render_process_id, int render_route_id, bool* hit_total_worker_limit); |
110 | 120 |
111 // Tries to see if any of the queued workers can be created. | 121 // Tries to see if any of the queued workers can be created. |
112 void TryStartingQueuedWorker(); | 122 void TryStartingQueuedWorker(); |
113 | 123 |
114 // APIs for manipulating our set of pending shared worker instances. | 124 // APIs for manipulating our set of pending shared worker instances. |
115 WorkerProcessHost::WorkerInstance* CreatePendingInstance( | 125 WorkerProcessHost::WorkerInstance* CreatePendingInstance( |
116 const GURL& url, | 126 const GURL& url, |
117 const string16& name, | 127 const string16& name, |
118 ResourceContext* resource_context); | 128 const std::string& partition_id, |
| 129 ResourceContext* resource_context, |
| 130 ChromeAppCacheService* appcache_service, |
| 131 fileapi::FileSystemContext* filesystem_context, |
| 132 webkit_database::DatabaseTracker* database_tracker, |
| 133 IndexedDBContextImpl* indexed_db_context); |
119 WorkerProcessHost::WorkerInstance* FindPendingInstance( | 134 WorkerProcessHost::WorkerInstance* FindPendingInstance( |
120 const GURL& url, | 135 const GURL& url, |
121 const string16& name, | 136 const string16& name, |
| 137 const std::string& partition_id, |
122 ResourceContext* resource_context); | 138 ResourceContext* resource_context); |
123 void RemovePendingInstances( | 139 void RemovePendingInstances( |
124 const GURL& url, | 140 const GURL& url, |
125 const string16& name, | 141 const string16& name, |
| 142 const std::string& partition_id, |
126 ResourceContext* resource_context); | 143 ResourceContext* resource_context); |
127 | 144 |
128 WorkerProcessHost::WorkerInstance* FindSharedWorkerInstance( | 145 WorkerProcessHost::WorkerInstance* FindSharedWorkerInstance( |
129 const GURL& url, | 146 const GURL& url, |
130 const string16& name, | 147 const string16& name, |
| 148 const std::string& partition_id, |
131 ResourceContext* resource_context); | 149 ResourceContext* resource_context); |
132 | 150 |
133 NotificationRegistrar registrar_; | 151 NotificationRegistrar registrar_; |
134 int next_worker_route_id_; | 152 int next_worker_route_id_; |
135 | 153 |
136 WorkerProcessHost::Instances queued_workers_; | 154 WorkerProcessHost::Instances queued_workers_; |
137 | 155 |
138 // These are shared workers that have been looked up, but not created yet. | 156 // 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 | 157 // We need to keep a list of these to synchronously detect shared worker |
140 // URL mismatches when two pages launch shared workers simultaneously. | 158 // URL mismatches when two pages launch shared workers simultaneously. |
141 WorkerProcessHost::Instances pending_shared_workers_; | 159 WorkerProcessHost::Instances pending_shared_workers_; |
142 | 160 |
143 ObserverList<WorkerServiceObserver> observers_; | 161 ObserverList<WorkerServiceObserver> observers_; |
144 | 162 |
145 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); | 163 DISALLOW_COPY_AND_ASSIGN(WorkerServiceImpl); |
146 }; | 164 }; |
147 | 165 |
148 } // namespace content | 166 } // namespace content |
149 | 167 |
150 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ | 168 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_SERVICE_H_ |
OLD | NEW |