| 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 <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" |
| 12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 18 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
| 19 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 20 #include "content/common/service_worker/service_worker_status_code.h" | 21 #include "content/common/service_worker/service_worker_status_code.h" |
| 21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 139 |
| 139 // Called back from Registry when the worker instance has ack'ed that | 140 // Called back from Registry when the worker instance has ack'ed that |
| 140 // it finished loading the script and has started a worker thread. | 141 // it finished loading the script and has started a worker thread. |
| 141 void OnScriptLoaded(int thread_id); | 142 void OnScriptLoaded(int thread_id); |
| 142 | 143 |
| 143 // Called back from Registry when the worker instance has ack'ed that | 144 // Called back from Registry when the worker instance has ack'ed that |
| 144 // it failed to load the script. | 145 // it failed to load the script. |
| 145 void OnScriptLoadFailed(); | 146 void OnScriptLoadFailed(); |
| 146 | 147 |
| 147 // Called back from Registry when the worker instance has ack'ed that | 148 // Called back from Registry when the worker instance has ack'ed that |
| 149 // it finished evaluating the script. |
| 150 void OnScriptEvaluated(bool success); |
| 151 |
| 152 // Called back from Registry when the worker instance has ack'ed that |
| 148 // its WorkerGlobalScope is actually started and parsed. | 153 // its WorkerGlobalScope is actually started and parsed. |
| 149 // This will change the internal status from STARTING to RUNNING. | 154 // This will change the internal status from STARTING to RUNNING. |
| 150 void OnStarted(); | 155 void OnStarted(); |
| 151 | 156 |
| 152 void OnPausedAfterDownload(); | 157 void OnPausedAfterDownload(); |
| 153 | 158 |
| 154 // Called back from Registry when the worker instance has ack'ed that | 159 // Called back from Registry when the worker instance has ack'ed that |
| 155 // its WorkerGlobalScope is actually stopped in the child process. | 160 // its WorkerGlobalScope is actually stopped in the child process. |
| 156 // This will change the internal status from STARTING or RUNNING to | 161 // This will change the internal status from STARTING or RUNNING to |
| 157 // STOPPED. | 162 // STOPPED. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 178 base::WeakPtr<ServiceWorkerContextCore> context_; | 183 base::WeakPtr<ServiceWorkerContextCore> context_; |
| 179 scoped_refptr<EmbeddedWorkerRegistry> registry_; | 184 scoped_refptr<EmbeddedWorkerRegistry> registry_; |
| 180 const int embedded_worker_id_; | 185 const int embedded_worker_id_; |
| 181 Status status_; | 186 Status status_; |
| 182 | 187 |
| 183 // Current running information. -1 indicates the worker is not running. | 188 // Current running information. -1 indicates the worker is not running. |
| 184 int process_id_; | 189 int process_id_; |
| 185 int thread_id_; | 190 int thread_id_; |
| 186 int worker_devtools_agent_route_id_; | 191 int worker_devtools_agent_route_id_; |
| 187 | 192 |
| 193 StatusCallback start_callback_; |
| 194 |
| 188 ListenerList listener_list_; | 195 ListenerList listener_list_; |
| 189 | 196 |
| 190 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 197 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
| 191 | 198 |
| 192 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 199 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
| 193 }; | 200 }; |
| 194 | 201 |
| 195 } // namespace content | 202 } // namespace content |
| 196 | 203 |
| 197 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 204 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
| OLD | NEW |