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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 void OnProcessAllocated(std::unique_ptr<WorkerProcessHandle> handle, | 209 void OnProcessAllocated(std::unique_ptr<WorkerProcessHandle> handle, |
210 ServiceWorkerMetrics::StartSituation start_situation); | 210 ServiceWorkerMetrics::StartSituation start_situation); |
211 | 211 |
212 // Called back from StartTask after the worker is registered to | 212 // Called back from StartTask after the worker is registered to |
213 // WorkerDevToolsManager. | 213 // WorkerDevToolsManager. |
214 void OnRegisteredToDevToolsManager(bool is_new_process, | 214 void OnRegisteredToDevToolsManager(bool is_new_process, |
215 int worker_devtools_agent_route_id, | 215 int worker_devtools_agent_route_id, |
216 bool wait_for_debugger); | 216 bool wait_for_debugger); |
217 | 217 |
218 // Sends StartWorker message via Mojo. | 218 // Sends StartWorker message via Mojo. |
219 ServiceWorkerStatusCode SendMojoStartWorker( | 219 ServiceWorkerStatusCode SendStartWorker( |
220 std::unique_ptr<EmbeddedWorkerStartParams> params); | 220 std::unique_ptr<EmbeddedWorkerStartParams> params); |
221 | 221 |
222 // Called back from StartTask after a start worker message is sent. | 222 // Called back from StartTask after a start worker message is sent. |
223 void OnStartWorkerMessageSent(); | 223 void OnStartWorkerMessageSent(); |
224 | 224 |
225 // Called back from Registry when the worker instance has ack'ed that | 225 // Called back from Registry when the worker instance has ack'ed that |
226 // it is ready for inspection. | 226 // it is ready for inspection. |
227 void OnReadyForInspection(); | 227 void OnReadyForInspection(); |
228 | 228 |
229 // Called back from Registry when the worker instance has ack'ed that | 229 // Called back from Registry when the worker instance has ack'ed that |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 StartingPhase starting_phase_; | 299 StartingPhase starting_phase_; |
300 int restart_count_; | 300 int restart_count_; |
301 | 301 |
302 // Current running information. | 302 // Current running information. |
303 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; | 303 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; |
304 int thread_id_; | 304 int thread_id_; |
305 | 305 |
306 // |client_| is used to send messages to the renderer process. | 306 // |client_| is used to send messages to the renderer process. |
307 mojom::EmbeddedWorkerInstanceClientPtr client_; | 307 mojom::EmbeddedWorkerInstanceClientPtr client_; |
308 | 308 |
309 // TODO(shimazu): Remove this after non-mojo StartWorker is removed. | 309 // TODO(shimazu): Remove this after EmbeddedWorkerStartParams is changed to |
| 310 // a mojo struct. |
310 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; | 311 mojom::ServiceWorkerEventDispatcherRequest pending_dispatcher_request_; |
311 | 312 |
312 // Whether devtools is attached or not. | 313 // Whether devtools is attached or not. |
313 bool devtools_attached_; | 314 bool devtools_attached_; |
314 | 315 |
315 // True if the script load request accessed the network. If the script was | 316 // True if the script load request accessed the network. If the script was |
316 // served from HTTPCache or ServiceWorkerDatabase this value is false. | 317 // served from HTTPCache or ServiceWorkerDatabase this value is false. |
317 bool network_accessed_for_script_; | 318 bool network_accessed_for_script_; |
318 | 319 |
319 ListenerList listener_list_; | 320 ListenerList listener_list_; |
320 std::unique_ptr<DevToolsProxy> devtools_proxy_; | 321 std::unique_ptr<DevToolsProxy> devtools_proxy_; |
321 | 322 |
322 std::unique_ptr<StartTask> inflight_start_task_; | 323 std::unique_ptr<StartTask> inflight_start_task_; |
323 | 324 |
324 // This is valid only after a process is allocated for the worker. | 325 // This is valid only after a process is allocated for the worker. |
325 ServiceWorkerMetrics::StartSituation start_situation_ = | 326 ServiceWorkerMetrics::StartSituation start_situation_ = |
326 ServiceWorkerMetrics::StartSituation::UNKNOWN; | 327 ServiceWorkerMetrics::StartSituation::UNKNOWN; |
327 | 328 |
328 // Used for UMA. The start time of the current start sequence step. | 329 // Used for UMA. The start time of the current start sequence step. |
329 base::TimeTicks step_time_; | 330 base::TimeTicks step_time_; |
330 | 331 |
331 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 332 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
332 | 333 |
333 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 334 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
334 }; | 335 }; |
335 | 336 |
336 } // namespace content | 337 } // namespace content |
337 | 338 |
338 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 339 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
OLD | NEW |