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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // This enum is used in UMA histograms, so don't change the order or remove | 59 // This enum is used in UMA histograms, so don't change the order or remove |
60 // entries. | 60 // entries. |
61 enum StartingPhase { | 61 enum StartingPhase { |
62 NOT_STARTING, | 62 NOT_STARTING, |
63 ALLOCATING_PROCESS, | 63 ALLOCATING_PROCESS, |
64 REGISTERING_TO_DEVTOOLS, | 64 REGISTERING_TO_DEVTOOLS, |
65 SENT_START_WORKER, | 65 SENT_START_WORKER, |
66 SCRIPT_DOWNLOADING, | 66 SCRIPT_DOWNLOADING, |
67 SCRIPT_LOADED, | 67 SCRIPT_LOADED, |
68 SCRIPT_EVALUATED, | 68 SCRIPT_EVALUATED, |
| 69 THREAD_STARTED, // Happens after SENT_START_WORKER and before SCRIPT_LOADED |
69 STARTING_PHASE_MAX_VALUE, | 70 STARTING_PHASE_MAX_VALUE, |
70 }; | 71 }; |
71 | 72 |
72 class Listener { | 73 class Listener { |
73 public: | 74 public: |
74 virtual ~Listener() {} | 75 virtual ~Listener() {} |
75 virtual void OnScriptLoaded() {} | 76 virtual void OnThreadStarted() {} |
76 virtual void OnStarting() {} | 77 virtual void OnStarting() {} |
77 virtual void OnStarted() {} | 78 virtual void OnStarted() {} |
78 virtual void OnStopping() {} | 79 virtual void OnStopping() {} |
79 // Received ACK from renderer that the worker context terminated. | 80 // Received ACK from renderer that the worker context terminated. |
80 virtual void OnStopped(Status old_status) {} | 81 virtual void OnStopped(Status old_status) {} |
81 // The browser-side IPC endpoint for communication with the worker died. | 82 // The browser-side IPC endpoint for communication with the worker died. |
82 virtual void OnDetached(Status old_status) {} | 83 virtual void OnDetached(Status old_status) {} |
83 virtual void OnReportException(const base::string16& error_message, | 84 virtual void OnReportException(const base::string16& error_message, |
84 int line_number, | 85 int line_number, |
85 int column_number, | 86 int column_number, |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const StatusCallback& callback, | 181 const StatusCallback& callback, |
181 bool is_new_process, | 182 bool is_new_process, |
182 int worker_devtools_agent_route_id, | 183 int worker_devtools_agent_route_id, |
183 bool wait_for_debugger); | 184 bool wait_for_debugger); |
184 | 185 |
185 // Called back from Registry when the worker instance has ack'ed that | 186 // Called back from Registry when the worker instance has ack'ed that |
186 // it is ready for inspection. | 187 // it is ready for inspection. |
187 void OnReadyForInspection(); | 188 void OnReadyForInspection(); |
188 | 189 |
189 // Called back from Registry when the worker instance has ack'ed that | 190 // Called back from Registry when the worker instance has ack'ed that |
190 // it finished loading the script and has started a worker thread. | 191 // it finished loading the script. |
191 void OnScriptLoaded(int thread_id); | 192 void OnScriptLoaded(); |
| 193 |
| 194 // Called back from Registry when the worker instance has ack'ed that |
| 195 // it has started a worker thread. |
| 196 void OnThreadStarted(int thread_id); |
192 | 197 |
193 // Called back from Registry when the worker instance has ack'ed that | 198 // Called back from Registry when the worker instance has ack'ed that |
194 // it failed to load the script. | 199 // it failed to load the script. |
195 void OnScriptLoadFailed(); | 200 void OnScriptLoadFailed(); |
196 | 201 |
197 // Called back from Registry when the worker instance has ack'ed that | 202 // Called back from Registry when the worker instance has ack'ed that |
198 // it finished evaluating the script. This is called before OnStarted. | 203 // it finished evaluating the script. This is called before OnStarted. |
199 void OnScriptEvaluated(bool success); | 204 void OnScriptEvaluated(bool success); |
200 | 205 |
201 // Called back from Registry when the worker instance has ack'ed that its | 206 // Called back from Registry when the worker instance has ack'ed that its |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 base::TimeTicks start_timing_; | 263 base::TimeTicks start_timing_; |
259 | 264 |
260 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; | 265 base::WeakPtrFactory<EmbeddedWorkerInstance> weak_factory_; |
261 | 266 |
262 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); | 267 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstance); |
263 }; | 268 }; |
264 | 269 |
265 } // namespace content | 270 } // namespace content |
266 | 271 |
267 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ | 272 #endif // CONTENT_BROWSER_SERVICE_WORKER_EMBEDDED_WORKER_INSTANCE_H_ |
OLD | NEW |