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