| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // STOPPED status. |callback| is invoked after the worker script has been | 107 // STOPPED status. |callback| is invoked after the worker script has been |
| 108 // started and evaluated, or when an error occurs. | 108 // started and evaluated, or when an error occurs. |
| 109 // |params| should be populated with service worker version info needed | 109 // |params| should be populated with service worker version info needed |
| 110 // to start the worker. | 110 // to start the worker. |
| 111 void Start(std::unique_ptr<EmbeddedWorkerStartParams> params, | 111 void Start(std::unique_ptr<EmbeddedWorkerStartParams> params, |
| 112 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, | 112 mojom::ServiceWorkerEventDispatcherRequest dispatcher_request, |
| 113 const StatusCallback& callback); | 113 const StatusCallback& callback); |
| 114 | 114 |
| 115 // Stops the worker. It is invalid to call this when the worker is | 115 // Stops the worker. It is invalid to call this when the worker is |
| 116 // not in STARTING or RUNNING status. | 116 // not in STARTING or RUNNING status. |
| 117 // This returns false if stopping a worker fails immediately, e.g. when | 117 // This returns false when StopWorker IPC couldn't be sent to the worker. |
| 118 // IPC couldn't be sent to the worker. | 118 bool Stop(); |
| 119 ServiceWorkerStatusCode Stop(); | |
| 120 | 119 |
| 121 // Stops the worker if the worker is not being debugged (i.e. devtools is | 120 // Stops the worker if the worker is not being debugged (i.e. devtools is |
| 122 // not attached). This method is called by a stop-worker timer to kill | 121 // not attached). This method is called by a stop-worker timer to kill |
| 123 // idle workers. | 122 // idle workers. |
| 124 void StopIfIdle(); | 123 void StopIfIdle(); |
| 125 | 124 |
| 126 // Sends |message| to the embedded worker running in the child process. | 125 // Sends |message| to the embedded worker running in the child process. |
| 127 // It is invalid to call this while the worker is not in STARTING or RUNNING | 126 // It is invalid to call this while the worker is not in STARTING or RUNNING |
| 128 // status. | 127 // status. |
| 129 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); | 128 ServiceWorkerStatusCode SendMessage(const IPC::Message& message); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 base::TimeTicks step_time_; | 327 base::TimeTicks step_time_; |
| 329 | 328 |
| 330 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 329 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
| 331 | 330 |
| 332 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 331 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 333 }; | 332 }; |
| 334 | 333 |
| 335 } // namespace content | 334 } // namespace content |
| 336 | 335 |
| 337 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 336 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |