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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 static std::string StatusToString(Status status); | 146 static std::string StatusToString(Status status); |
147 static std::string StartingPhaseToString(StartingPhase phase); | 147 static std::string StartingPhaseToString(StartingPhase phase); |
148 | 148 |
149 private: | 149 private: |
150 typedef base::ObserverList<Listener> ListenerList; | 150 typedef base::ObserverList<Listener> ListenerList; |
151 class DevToolsProxy; | 151 class DevToolsProxy; |
152 friend class EmbeddedWorkerRegistry; | 152 friend class EmbeddedWorkerRegistry; |
153 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); | 153 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StartAndStop); |
154 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, DetachDuringStart); | 154 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, DetachDuringStart); |
155 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StopDuringStart); | 155 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, StopDuringStart); |
| 156 FRIEND_TEST_ALL_PREFIXES(EmbeddedWorkerInstanceTest, DestroyDuringStart); |
156 | 157 |
157 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). | 158 // Constructor is called via EmbeddedWorkerRegistry::CreateWorker(). |
158 // This instance holds a ref of |registry|. | 159 // This instance holds a ref of |registry|. |
159 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context, | 160 EmbeddedWorkerInstance(base::WeakPtr<ServiceWorkerContextCore> context, |
160 int embedded_worker_id); | 161 int embedded_worker_id); |
161 | 162 |
162 // Called back from ServiceWorkerProcessManager after Start() passes control | 163 // Called back from ServiceWorkerProcessManager after Start() passes control |
163 // to the UI thread to acquire a reference to the process. | 164 // to the UI thread to acquire a reference to the process. |
164 static void RunProcessAllocated( | 165 static void RunProcessAllocated( |
165 base::WeakPtr<EmbeddedWorkerInstance> instance, | 166 base::WeakPtr<EmbeddedWorkerInstance> instance, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 const GURL& source_url); | 226 const GURL& source_url); |
226 | 227 |
227 // Called back from Registry when the worker instance reports to the console. | 228 // Called back from Registry when the worker instance reports to the console. |
228 void OnReportConsoleMessage(int source_identifier, | 229 void OnReportConsoleMessage(int source_identifier, |
229 int message_level, | 230 int message_level, |
230 const base::string16& message, | 231 const base::string16& message, |
231 int line_number, | 232 int line_number, |
232 const GURL& source_url); | 233 const GURL& source_url); |
233 | 234 |
234 void ReleaseProcess(); | 235 void ReleaseProcess(); |
| 236 void OnStartFailed(ServiceWorkerStatusCode status, |
| 237 const StatusCallback& callback); |
235 | 238 |
236 base::WeakPtr<ServiceWorkerContextCore> context_; | 239 base::WeakPtr<ServiceWorkerContextCore> context_; |
237 scoped_refptr<EmbeddedWorkerRegistry> registry_; | 240 scoped_refptr<EmbeddedWorkerRegistry> registry_; |
238 const int embedded_worker_id_; | 241 const int embedded_worker_id_; |
239 Status status_; | 242 Status status_; |
240 StartingPhase starting_phase_; | 243 StartingPhase starting_phase_; |
241 | 244 |
242 // Current running information. -1 indicates the worker is not running. | 245 // Current running information. -1 indicates the worker is not running. |
243 int process_id_; | 246 int process_id_; |
244 int thread_id_; | 247 int thread_id_; |
(...skipping 13 matching lines...) Expand all Loading... |
258 base::TimeTicks start_timing_; | 261 base::TimeTicks start_timing_; |
259 | 262 |
260 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 263 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
261 | 264 |
262 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 265 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
263 }; | 266 }; |
264 | 267 |
265 } // namespace content | 268 } // namespace content |
266 | 269 |
267 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 270 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
OLD | NEW |