Chromium Code Reviews| 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 | |
| 161 CONTENT_EXPORT const ChildProcessData& GetData(); | 164 CONTENT_EXPORT const ChildProcessData& GetData(); |
| 162 | 165 |
| 163 typedef std::list<WorkerInstance> Instances; | 166 typedef std::list<WorkerInstance> Instances; |
| 164 const Instances& instances() const { return instances_; } | 167 const Instances& instances() const { return instances_; } |
| 165 | 168 |
| 166 ResourceContext* resource_context() const { | 169 ResourceContext* resource_context() const { |
| 167 return resource_context_; | 170 return resource_context_; |
| 168 } | 171 } |
| 169 | 172 |
| 173 bool process_launched() const; | |
|
jam
2013/05/28 14:28:30
to be clear: this should be inlined like the above
shatch
2013/05/28 17:52:13
Done.
| |
| 174 | |
| 170 protected: | 175 protected: |
| 171 friend class WorkerServiceImpl; | 176 friend class WorkerServiceImpl; |
| 172 | 177 |
| 173 Instances& mutable_instances() { return instances_; } | 178 Instances& mutable_instances() { return instances_; } |
| 174 | 179 |
| 175 private: | 180 private: |
| 176 // BrowserChildProcessHostDelegate implementation: | 181 // BrowserChildProcessHostDelegate implementation: |
| 177 virtual void OnProcessLaunched() OVERRIDE; | 182 virtual void OnProcessLaunched() OVERRIDE; |
| 178 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 183 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 179 | 184 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 | 219 |
| 215 ResourceContext* const resource_context_; | 220 ResourceContext* const resource_context_; |
| 216 WorkerStoragePartition partition_; | 221 WorkerStoragePartition partition_; |
| 217 | 222 |
| 218 // A reference to the filter associated with this worker process. We need to | 223 // A reference to the filter associated with this worker process. We need to |
| 219 // keep this around since we'll use it when forward messages to the worker | 224 // keep this around since we'll use it when forward messages to the worker |
| 220 // process. | 225 // process. |
| 221 scoped_refptr<WorkerMessageFilter> worker_message_filter_; | 226 scoped_refptr<WorkerMessageFilter> worker_message_filter_; |
| 222 | 227 |
| 223 scoped_ptr<BrowserChildProcessHostImpl> process_; | 228 scoped_ptr<BrowserChildProcessHostImpl> process_; |
| 229 bool process_launched_; | |
| 224 | 230 |
| 225 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); | 231 DISALLOW_COPY_AND_ASSIGN(WorkerProcessHost); |
| 226 }; | 232 }; |
| 227 | 233 |
| 228 class WorkerProcessHostIterator | 234 class WorkerProcessHostIterator |
| 229 : public BrowserChildProcessHostTypeIterator<WorkerProcessHost> { | 235 : public BrowserChildProcessHostTypeIterator<WorkerProcessHost> { |
| 230 public: | 236 public: |
| 231 WorkerProcessHostIterator() | 237 WorkerProcessHostIterator() |
| 232 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( | 238 : BrowserChildProcessHostTypeIterator<WorkerProcessHost>( |
| 233 PROCESS_TYPE_WORKER) { | 239 PROCESS_TYPE_WORKER) { |
| 234 } | 240 } |
| 235 }; | 241 }; |
| 236 | 242 |
| 237 } // namespace content | 243 } // namespace content |
| 238 | 244 |
| 239 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ | 245 #endif // CONTENT_BROWSER_WORKER_HOST_WORKER_PROCESS_HOST_H_ |
| OLD | NEW |