| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Windows headers will redefine SendMessage. | 31 // Windows headers will redefine SendMessage. |
| 32 #ifdef SendMessage | 32 #ifdef SendMessage |
| 33 #undef SendMessage | 33 #undef SendMessage |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 namespace IPC { | 36 namespace IPC { |
| 37 class Message; | 37 class Message; |
| 38 } | 38 } |
| 39 | 39 |
| 40 namespace shell { | 40 namespace service_manager { |
| 41 class InterfaceProvider; | 41 class InterfaceProvider; |
| 42 class InterfaceRegistry; | 42 class InterfaceRegistry; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace content { | 45 namespace content { |
| 46 | 46 |
| 47 class EmbeddedWorkerRegistry; | 47 class EmbeddedWorkerRegistry; |
| 48 struct EmbeddedWorkerStartParams; | 48 struct EmbeddedWorkerStartParams; |
| 49 class MessagePortMessageFilter; | 49 class MessagePortMessageFilter; |
| 50 class ServiceWorkerContextCore; | 50 class ServiceWorkerContextCore; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void StopIfIdle(); | 127 void StopIfIdle(); |
| 128 | 128 |
| 129 // Sends |message| to the embedded worker running in the child process. | 129 // Sends |message| to the embedded worker running in the child process. |
| 130 // It is invalid to call this while the worker is not in STARTING or RUNNING | 130 // It is invalid to call this while the worker is not in STARTING or RUNNING |
| 131 // status. | 131 // status. |
| 132 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); | 132 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); |
| 133 | 133 |
| 134 // Resumes the worker if it paused after download. | 134 // Resumes the worker if it paused after download. |
| 135 void ResumeAfterDownload(); | 135 void ResumeAfterDownload(); |
| 136 | 136 |
| 137 // Returns the shell::InterfaceRegistry and shell::InterfaceProvider for this | 137 // Returns the service_manager::InterfaceRegistry and |
| 138 // service_manager::InterfaceProvider for this |
| 138 // worker. It is invalid to call this when the worker is not in STARTING or | 139 // worker. It is invalid to call this when the worker is not in STARTING or |
| 139 // RUNNING status. | 140 // RUNNING status. |
| 140 shell::InterfaceRegistry* GetInterfaceRegistry(); | 141 service_manager::InterfaceRegistry* GetInterfaceRegistry(); |
| 141 shell::InterfaceProvider* GetRemoteInterfaces(); | 142 service_manager::InterfaceProvider* GetRemoteInterfaces(); |
| 142 | 143 |
| 143 int embedded_worker_id() const { return embedded_worker_id_; } | 144 int embedded_worker_id() const { return embedded_worker_id_; } |
| 144 EmbeddedWorkerStatus status() const { return status_; } | 145 EmbeddedWorkerStatus status() const { return status_; } |
| 145 StartingPhase starting_phase() const { | 146 StartingPhase starting_phase() const { |
| 146 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, status()); | 147 DCHECK_EQ(EmbeddedWorkerStatus::STARTING, status()); |
| 147 return starting_phase_; | 148 return starting_phase_; |
| 148 } | 149 } |
| 149 int process_id() const; | 150 int process_id() const; |
| 150 int thread_id() const { return thread_id_; } | 151 int thread_id() const { return thread_id_; } |
| 151 // This should be called only when the worker instance has a valid process, | 152 // This should be called only when the worker instance has a valid process, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 const int embedded_worker_id_; | 305 const int embedded_worker_id_; |
| 305 | 306 |
| 306 EmbeddedWorkerStatus status_; | 307 EmbeddedWorkerStatus status_; |
| 307 StartingPhase starting_phase_; | 308 StartingPhase starting_phase_; |
| 308 | 309 |
| 309 // Current running information. | 310 // Current running information. |
| 310 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; | 311 std::unique_ptr<EmbeddedWorkerInstance::WorkerProcessHandle> process_handle_; |
| 311 int thread_id_; | 312 int thread_id_; |
| 312 | 313 |
| 313 // These are connected to the renderer process after OnThreadStarted. | 314 // These are connected to the renderer process after OnThreadStarted. |
| 314 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; | 315 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_; |
| 315 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; | 316 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_; |
| 316 // |client_| is used to send messages to the renderer process. | 317 // |client_| is used to send messages to the renderer process. |
| 317 mojom::EmbeddedWorkerInstanceClientPtr client_; | 318 mojom::EmbeddedWorkerInstanceClientPtr client_; |
| 318 | 319 |
| 319 // Whether devtools is attached or not. | 320 // Whether devtools is attached or not. |
| 320 bool devtools_attached_; | 321 bool devtools_attached_; |
| 321 | 322 |
| 322 // True if the script load request accessed the network. If the script was | 323 // True if the script load request accessed the network. If the script was |
| 323 // served from HTTPCache or ServiceWorkerDatabase this value is false. | 324 // served from HTTPCache or ServiceWorkerDatabase this value is false. |
| 324 bool network_accessed_for_script_; | 325 bool network_accessed_for_script_; |
| 325 | 326 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 336 base::TimeTicks step_time_; | 337 base::TimeTicks step_time_; |
| 337 | 338 |
| 338 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 339 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
| 339 | 340 |
| 340 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 341 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 341 }; | 342 }; |
| 342 | 343 |
| 343 } // namespace content | 344 } // namespace content |
| 344 | 345 |
| 345 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 346 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |