| 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_PROCESS_HOST_H_ | 5 #ifndef CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 6 #define CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 void FilterShutdown(WorkerMessageFilter* filter); | 151 void FilterShutdown(WorkerMessageFilter* filter); |
| 152 | 152 |
| 153 // Shuts down any shared workers that are no longer referenced by active | 153 // Shuts down any shared workers that are no longer referenced by active |
| 154 // documents. | 154 // documents. |
| 155 void DocumentDetached(WorkerMessageFilter* filter, | 155 void DocumentDetached(WorkerMessageFilter* filter, |
| 156 unsigned long long document_id); | 156 unsigned long long document_id); |
| 157 | 157 |
| 158 // Terminates the given worker, i.e. based on a UI action. | 158 // Terminates the given worker, i.e. based on a UI action. |
| 159 CONTENT_EXPORT void TerminateWorker(int worker_route_id); | 159 CONTENT_EXPORT void TerminateWorker(int worker_route_id); |
| 160 | 160 |
| 161 // Callers can reduce the WorkerProcess' priority. | |
| 162 void SetBackgrounded(bool backgrounded); | |
| 163 | |
| 164 CONTENT_EXPORT const ChildProcessData& GetData(); | 161 CONTENT_EXPORT const ChildProcessData& GetData(); |
| 165 | 162 |
| 166 typedef std::list<WorkerInstance> Instances; | 163 typedef std::list<WorkerInstance> Instances; |
| 167 const Instances& instances() const { return instances_; } | 164 const Instances& instances() const { return instances_; } |
| 168 | 165 |
| 169 ResourceContext* resource_context() const { | 166 ResourceContext* resource_context() const { |
| 170 return resource_context_; | 167 return resource_context_; |
| 171 } | 168 } |
| 172 | 169 |
| 173 bool process_launched() const; | |
| 174 | |
| 175 protected: | 170 protected: |
| 176 friend class WorkerServiceImpl; | 171 friend class WorkerServiceImpl; |
| 177 | 172 |
| 178 Instances& mutable_instances() { return instances_; } | 173 Instances& mutable_instances() { return instances_; } |
| 179 | 174 |
| 180 private: | 175 private: |
| 181 // BrowserChildProcessHostDelegate implementation: | 176 // BrowserChildProcessHostDelegate implementation: |
| 182 virtual void OnProcessLaunched() OVERRIDE; | 177 virtual void OnProcessLaunched() OVERRIDE; |
| 183 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 184 | 179 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 214 |
| 220 ResourceContext* const resource_context_; | 215 ResourceContext* const resource_context_; |
| 221 WorkerStoragePartition partition_; | 216 WorkerStoragePartition partition_; |
| 222 | 217 |
| 223 // A reference to the filter associated with this worker process. We need to | 218 // A reference to the filter associated with this worker process. We need to |
| 224 // keep this around since we'll use it when forward messages to the worker | 219 // keep this around since we'll use it when forward messages to the worker |
| 225 // process. | 220 // process. |
| 226 scoped_refptr<WorkerMessageFilter> worker_message_filter_; | 221 scoped_refptr<WorkerMessageFilter> worker_message_filter_; |
| 227 | 222 |
| 228 scoped_ptr<BrowserChildProcessHostImpl> process_; | 223 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 229 bool process_launched_; | |
| 230 | 224 |
| 231 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); | 225 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
| 232 }; | 226 }; |
| 233 | 227 |
| 234 class WorkerProcessHostIterator | 228 class WorkerProcessHostIterator |
| 235 : public BrowserChildProcessHostTypeIterator<WorkerProcessHost> { | 229 : public BrowserChildProcessHostTypeIterator<WorkerProcessHost> { |
| 236 public: | 230 public: |
| 237 WorkerProcessHostIterator() | 231 WorkerProcessHostIterator() |
| 238 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( | 232 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( |
| 239 PROCESS_TYPE_WORKER) { | 233 PROCESS_TYPE_WORKER) { |
| 240 } | 234 } |
| 241 }; | 235 }; |
| 242 | 236 |
| 243 } // namespace content | 237 } // namespace content |
| 244 | 238 |
| 245 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 239 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| OLD | NEW |