| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 // Resumes the worker if it paused after download. | 130 // Resumes the worker if it paused after download. |
| 131 void ResumeAfterDownload(); | 131 void ResumeAfterDownload(); |
| 132 | 132 |
| 133 int embedded_worker_id() const { return embedded_worker_id_; } | 133 int embedded_worker_id() const { return embedded_worker_id_; } |
| 134 EmbeddedWorkerStatus status() const { return status_; } | 134 EmbeddedWorkerStatus status() const { return status_; } |
| 135 StartingPhase starting_phase() const { | 135 StartingPhase starting_phase() const { |
| 136 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, status()); | 136 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, status()); |
| 137 return starting_phase_; | 137 return starting_phase_; |
| 138 } | 138 } |
| 139 int restart_count() const { return restart_count_; } |
| 139 int process_id() const; | 140 int process_id() const; |
| 140 int thread_id() const { return thread_id_; } | 141 int thread_id() const { return thread_id_; } |
| 141 // This should be called only when the worker instance has a valid process, | 142 // This should be called only when the worker instance has a valid process, |
| 142 // that is, when |process_id()| returns a valid process id. | 143 // that is, when |process_id()| returns a valid process id. |
| 143 bool is_new_process() const; | 144 bool is_new_process() const; |
| 144 int worker_devtools_agent_route_id() const; | 145 int worker_devtools_agent_route_id() const; |
| 145 MessagePortMessageFilter* message_port_message_filter() const; | 146 MessagePortMessageFilter* message_port_message_filter() const; |
| 146 | 147 |
| 147 void AddListener(Listener* listener); | 148 void AddListener(Listener* listener); |
| 148 void RemoveListener(Listener* listener); | 149 void RemoveListener(Listener* listener); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 base::TimeDelta UpdateStepTime(); | 290 base::TimeDelta UpdateStepTime(); |
| 290 | 291 |
| 291 base::WeakPtr<ServiceWorkerContextCore> context_; | 292 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 292 scoped_refptr<EmbeddedWorkerRegistry> registry_; | 293 scoped_refptr<EmbeddedWorkerRegistry> registry_; |
| 293 | 294 |
| 294 // Unique within an EmbeddedWorkerRegistry. | 295 // Unique within an EmbeddedWorkerRegistry. |
| 295 const int embedded_worker_id_; | 296 const int embedded_worker_id_; |
| 296 | 297 |
| 297 EmbeddedWorkerStatus status_; | 298 EmbeddedWorkerStatus status_; |
| 298 StartingPhase starting_phase_; | 299 StartingPhase starting_phase_; |
| 300 int restart_count_; |
| 299 | 301 |
| 300 // Current running information. | 302 // Current running information. |
| 301 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; | 303 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; |
| 302 int thread_id_; | 304 int thread_id_; |
| 303 | 305 |
| 304 // |client_| is used to send messages to the renderer process. | 306 // |client_| is used to send messages to the renderer process. |
| 305 mojom::EmbeddedWorkerInstanceClientPtr client_; | 307 mojom::EmbeddedWorkerInstanceClientPtr client_; |
| 306 | 308 |
| 307 // TODO(shimazu): Remove this after non-mojo StartWorker is removed. | 309 // TODO(shimazu): Remove this after non-mojo StartWorker is removed. |
| 308 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; | 310 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 327 base::TimeTicks step_time_; | 329 base::TimeTicks step_time_; |
| 328 | 330 |
| 329 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 331 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
| 330 | 332 |
| 331 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 333 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 332 }; | 334 }; |
| 333 | 335 |
| 334 } // namespace content | 336 } // namespace content |
| 335 | 337 |
| 336 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 338 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |