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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
14 #include "base/basictypes.h"
15 #include "base/callback.h"
16 #include "base/gtest_prod_util.h"
17 #include "base/id_map.h"
18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h"
20 #include "base/observer_list.h"
21 #include "base/timer/timer.h"
22 #include "content/browser/service_worker/embedded_worker_instance.h"
23 #include "content/browser/service_worker/service_worker_script_cache_map.h"
24 #include "content/common/background_sync_service.mojom.h"
25 #include "content/common/content_export.h"
26 #include "content/common/service_port_service.mojom.h"
27 #include "content/common/service_worker/service_worker_status_code.h"
28 #include "content/common/service_worker/service_worker_types.h"
29 #include "content/public/common/service_registry.h"
30 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h"
31 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h"
33 // Windows headers will redefine SendMessage.
41 struct WebCircularGeofencingRegion
;
45 class HttpResponseInfo
;
50 class EmbeddedWorkerRegistry
;
51 class ServiceWorkerContextCore
;
52 class ServiceWorkerProviderHost
;
53 class ServiceWorkerRegistration
;
54 class ServiceWorkerURLRequestJob
;
55 struct NavigatorConnectClient
;
56 struct PlatformNotificationData
;
57 struct ServiceWorkerClientInfo
;
58 struct ServiceWorkerVersionInfo
;
59 struct TransferredMessagePort
;
61 // This class corresponds to a specific version of a ServiceWorker
62 // script for a given pattern. When a script is upgraded, there may be
63 // more than one ServiceWorkerVersion "running" at a time, but only
64 // one of them is activated. This class connects the actual script with a
66 class CONTENT_EXPORT ServiceWorkerVersion
67 : NON_EXPORTED_BASE(public base::RefCounted
<ServiceWorkerVersion
>),
68 public EmbeddedWorkerInstance::Listener
{
70 typedef base::Callback
<void(ServiceWorkerStatusCode
)> StatusCallback
;
71 typedef base::Callback
<void(ServiceWorkerStatusCode
,
72 ServiceWorkerFetchEventResult
,
73 const ServiceWorkerResponse
&)> FetchCallback
;
74 typedef base::Callback
<void(ServiceWorkerStatusCode
,
75 bool /* accept_connction */,
76 const base::string16
& /* name */,
77 const base::string16
& /* data */)>
78 ServicePortConnectCallback
;
81 STOPPED
= EmbeddedWorkerInstance::STOPPED
,
82 STARTING
= EmbeddedWorkerInstance::STARTING
,
83 RUNNING
= EmbeddedWorkerInstance::RUNNING
,
84 STOPPING
= EmbeddedWorkerInstance::STOPPING
,
87 // Current version status; some of the status (e.g. INSTALLED and ACTIVATED)
88 // should be persisted unlike running status.
90 NEW
, // The version is just created.
91 INSTALLING
, // Install event is dispatched and being handled.
92 INSTALLED
, // Install event is finished and is ready to be activated.
93 ACTIVATING
, // Activate event is dispatched and being handled.
94 ACTIVATED
, // Activation is finished and can run as activated.
95 REDUNDANT
, // The version is no longer running as activated, due to
96 // unregistration or replace.
101 virtual void OnRunningStateChanged(ServiceWorkerVersion
* version
) {}
102 virtual void OnVersionStateChanged(ServiceWorkerVersion
* version
) {}
103 virtual void OnMainScriptHttpResponseInfoSet(
104 ServiceWorkerVersion
* version
) {}
105 virtual void OnErrorReported(ServiceWorkerVersion
* version
,
106 const base::string16
& error_message
,
109 const GURL
& source_url
) {}
110 virtual void OnReportConsoleMessage(ServiceWorkerVersion
* version
,
111 int source_identifier
,
113 const base::string16
& message
,
115 const GURL
& source_url
) {}
116 virtual void OnControlleeAdded(ServiceWorkerVersion
* version
,
117 ServiceWorkerProviderHost
* provider_host
) {}
118 virtual void OnControlleeRemoved(ServiceWorkerVersion
* version
,
119 ServiceWorkerProviderHost
* provider_host
) {
121 // Fires when a version transitions from having a controllee to not.
122 virtual void OnNoControllees(ServiceWorkerVersion
* version
) {}
123 virtual void OnCachedMetadataUpdated(ServiceWorkerVersion
* version
) {}
126 virtual ~Listener() {}
129 ServiceWorkerVersion(
130 ServiceWorkerRegistration
* registration
,
131 const GURL
& script_url
,
133 base::WeakPtr
<ServiceWorkerContextCore
> context
);
135 int64
version_id() const { return version_id_
; }
136 int64
registration_id() const { return registration_id_
; }
137 const GURL
& script_url() const { return script_url_
; }
138 const GURL
& scope() const { return scope_
; }
139 RunningStatus
running_status() const {
140 return static_cast<RunningStatus
>(embedded_worker_
->status());
142 ServiceWorkerVersionInfo
GetInfo();
143 Status
status() const { return status_
; }
145 // This sets the new status and also run status change callbacks
146 // if there're any (see RegisterStatusChangeCallback).
147 void SetStatus(Status status
);
149 // Registers status change callback. (This is for one-off observation,
150 // the consumer needs to re-register if it wants to continue observing
152 void RegisterStatusChangeCallback(const base::Closure
& callback
);
154 // Starts an embedded worker for this version.
155 // This returns OK (success) if the worker is already running.
156 void StartWorker(const StatusCallback
& callback
);
158 // Stops an embedded worker for this version.
159 // This returns OK (success) if the worker is already stopped.
160 void StopWorker(const StatusCallback
& callback
);
162 // Schedules an update to be run 'soon'.
163 void ScheduleUpdate();
165 // If an update is scheduled but not yet started, this resets the timer
166 // delaying the start time by a 'small' amount.
167 void DeferScheduledUpdate();
169 // Starts an update now.
172 // Sends a message event to the associated embedded worker.
173 void DispatchMessageEvent(
174 const base::string16
& message
,
175 const std::vector
<TransferredMessagePort
>& sent_message_ports
,
176 const StatusCallback
& callback
);
178 // Sends install event to the associated embedded worker and asynchronously
179 // calls |callback| when it errors out or it gets a response from the worker
180 // to notify install completion.
182 // This must be called when the status() is NEW. Calling this changes
183 // the version's status to INSTALLING.
184 // Upon completion, the version's status will be changed to INSTALLED
185 // on success, or back to NEW on failure.
186 void DispatchInstallEvent(const StatusCallback
& callback
);
188 // Sends activate event to the associated embedded worker and asynchronously
189 // calls |callback| when it errors out or it gets a response from the worker
190 // to notify activation completion.
192 // This must be called when the status() is INSTALLED. Calling this changes
193 // the version's status to ACTIVATING.
194 // Upon completion, the version's status will be changed to ACTIVATED
195 // on success, or back to INSTALLED on failure.
196 void DispatchActivateEvent(const StatusCallback
& callback
);
198 // Sends fetch event to the associated embedded worker and calls
199 // |callback| with the response from the worker.
201 // This must be called when the status() is ACTIVATED. Calling this in other
202 // statuses will result in an error SERVICE_WORKER_ERROR_FAILED.
203 void DispatchFetchEvent(const ServiceWorkerFetchRequest
& request
,
204 const base::Closure
& prepare_callback
,
205 const FetchCallback
& fetch_callback
);
207 // Sends sync event to the associated embedded worker and asynchronously calls
208 // |callback| when it errors out or it gets a response from the worker to
209 // notify completion.
211 // This must be called when the status() is ACTIVATED.
212 void DispatchSyncEvent(SyncRegistrationPtr registration
,
213 const StatusCallback
& callback
);
215 // Sends notificationclick event to the associated embedded worker and
216 // asynchronously calls |callback| when it errors out or it gets a response
217 // from the worker to notify completion.
219 // This must be called when the status() is ACTIVATED.
220 void DispatchNotificationClickEvent(
221 const StatusCallback
& callback
,
222 int64_t persistent_notification_id
,
223 const PlatformNotificationData
& notification_data
);
225 // Sends push event to the associated embedded worker and asynchronously calls
226 // |callback| when it errors out or it gets a response from the worker to
227 // notify completion.
229 // This must be called when the status() is ACTIVATED.
230 void DispatchPushEvent(const StatusCallback
& callback
,
231 const std::string
& data
);
233 // Sends geofencing event to the associated embedded worker and asynchronously
234 // calls |callback| when it errors out or it gets a response from the worker
235 // to notify completion.
237 // This must be called when the status() is ACTIVATED.
238 void DispatchGeofencingEvent(
239 const StatusCallback
& callback
,
240 blink::WebGeofencingEventType event_type
,
241 const std::string
& region_id
,
242 const blink::WebCircularGeofencingRegion
& region
);
244 // Sends a ServicePort connect event to the associated embedded worker and
245 // asynchronously calls |callback| with the response from the worker.
247 // This must be called when the status() is ACTIVATED.
248 void DispatchServicePortConnectEvent(
249 const ServicePortConnectCallback
& callback
,
250 const GURL
& target_url
,
254 // Sends a cross origin message event to the associated embedded worker and
255 // asynchronously calls |callback| when the message was sent (or failed to
257 // It is the responsibility of the code calling this method to make sure that
258 // any transferred message ports are put on hold while potentially a process
259 // for the service worker is spun up.
261 // This must be called when the status() is ACTIVATED.
262 void DispatchCrossOriginMessageEvent(
263 const NavigatorConnectClient
& client
,
264 const base::string16
& message
,
265 const std::vector
<TransferredMessagePort
>& sent_message_ports
,
266 const StatusCallback
& callback
);
268 // Adds and removes |provider_host| as a controllee of this ServiceWorker.
269 // A potential controllee is a host having the version as its .installing
270 // or .waiting version.
271 void AddControllee(ServiceWorkerProviderHost
* provider_host
);
272 void RemoveControllee(ServiceWorkerProviderHost
* provider_host
);
274 // Returns if it has controllee.
275 bool HasControllee() const { return !controllee_map_
.empty(); }
277 // Returns whether the service worker has active window clients under its
279 bool HasWindowClients();
281 // Adds and removes |request_job| as a dependent job not to stop the
282 // ServiceWorker while |request_job| is reading the stream of the fetch event
283 // response from the ServiceWorker.
284 void AddStreamingURLRequestJob(const ServiceWorkerURLRequestJob
* request_job
);
285 void RemoveStreamingURLRequestJob(
286 const ServiceWorkerURLRequestJob
* request_job
);
288 // Adds and removes Listeners.
289 void AddListener(Listener
* listener
);
290 void RemoveListener(Listener
* listener
);
292 ServiceWorkerScriptCacheMap
* script_cache_map() { return &script_cache_map_
; }
293 EmbeddedWorkerInstance
* embedded_worker() { return embedded_worker_
.get(); }
295 // Reports the error message to |listeners_|.
296 void ReportError(ServiceWorkerStatusCode status
,
297 const std::string
& status_message
);
299 // Sets the status code to pass to StartWorker callbacks if start fails.
300 void SetStartWorkerStatusCode(ServiceWorkerStatusCode status
);
302 // Sets this version's status to REDUNDANT and deletes its resources.
303 // The version must not have controllees.
305 bool is_redundant() const { return status_
== REDUNDANT
; }
307 bool skip_waiting() const { return skip_waiting_
; }
308 void set_skip_waiting(bool skip_waiting
) { skip_waiting_
= skip_waiting
; }
310 bool force_bypass_cache_for_scripts() {
311 return force_bypass_cache_for_scripts_
;
313 void set_force_bypass_cache_for_scripts(bool force_bypass_cache_for_scripts
) {
314 force_bypass_cache_for_scripts_
= force_bypass_cache_for_scripts
;
317 void SetDevToolsAttached(bool attached
);
319 // Sets the HttpResponseInfo used to load the main script.
320 // This HttpResponseInfo will be used for all responses sent back from the
321 // service worker, as the effective security of these responses is equivalent
322 // to that of the ServiceWorker.
323 void SetMainScriptHttpResponseInfo(const net::HttpResponseInfo
& http_info
);
324 const net::HttpResponseInfo
* GetMainScriptHttpResponseInfo();
326 // Simulate ping timeout. Should be used for tests-only.
327 void SimulatePingTimeoutForTesting();
330 friend class base::RefCounted
<ServiceWorkerVersion
>;
331 friend class ServiceWorkerMetrics
;
332 friend class ServiceWorkerURLRequestJobTest
;
333 friend class ServiceWorkerVersionBrowserTest
;
335 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest
,
336 ActivateWaitingVersion
);
337 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
, IdleTimeout
);
338 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
, SetDevToolsAttached
);
339 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
, StaleUpdate_FreshWorker
);
340 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
,
341 StaleUpdate_NonActiveWorker
);
342 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
, StaleUpdate_StartWorker
);
343 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
, StaleUpdate_RunningWorker
);
344 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionTest
,
345 StaleUpdate_DoNotDeferTimer
);
346 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerWaitForeverInFetchTest
, RequestTimeout
);
347 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerFailToStartTest
, Timeout
);
348 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest
,
349 TimeoutStartingWorker
);
350 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerVersionBrowserTest
,
351 TimeoutWorkerInEvent
);
354 class PingController
;
356 typedef ServiceWorkerVersion self
;
357 using ServiceWorkerClients
= std::vector
<ServiceWorkerClientInfo
>;
364 REQUEST_NOTIFICATION_CLICK
,
367 REQUEST_SERVICE_PORT_CONNECT
371 RequestInfo(int id
, RequestType type
, const base::TimeTicks
& time
);
375 base::TimeTicks time
;
378 template <typename CallbackType
>
379 struct PendingRequest
{
380 PendingRequest(const CallbackType
& callback
, const base::TimeTicks
& time
);
383 CallbackType callback
;
384 base::TimeTicks start_time
;
387 // Timeout for the worker to start.
388 static const int kStartWorkerTimeoutMinutes
;
389 // Timeout for a request to be handled.
390 static const int kRequestTimeoutMinutes
;
392 ~ServiceWorkerVersion() override
;
394 // EmbeddedWorkerInstance::Listener overrides:
395 void OnScriptLoaded() override
;
396 void OnStarting() override
;
397 void OnStarted() override
;
398 void OnStopping() override
;
399 void OnStopped(EmbeddedWorkerInstance::Status old_status
) override
;
400 void OnDetached(EmbeddedWorkerInstance::Status old_status
) override
;
401 void OnReportException(const base::string16
& error_message
,
404 const GURL
& source_url
) override
;
405 void OnReportConsoleMessage(int source_identifier
,
407 const base::string16
& message
,
409 const GURL
& source_url
) override
;
410 bool OnMessageReceived(const IPC::Message
& message
) override
;
412 void OnStartSentAndScriptEvaluated(ServiceWorkerStatusCode status
);
414 void DispatchInstallEventAfterStartWorker(const StatusCallback
& callback
);
415 void DispatchActivateEventAfterStartWorker(const StatusCallback
& callback
);
417 void DispatchMessageEventInternal(
418 const base::string16
& message
,
419 const std::vector
<TransferredMessagePort
>& sent_message_ports
,
420 const StatusCallback
& callback
);
424 // This corresponds to the spec's matchAll(options) steps.
425 void OnGetClients(int request_id
,
426 const ServiceWorkerClientQueryOptions
& options
);
428 void OnActivateEventFinished(int request_id
,
429 blink::WebServiceWorkerEventResult result
);
430 void OnInstallEventFinished(int request_id
,
431 blink::WebServiceWorkerEventResult result
);
432 void OnFetchEventFinished(int request_id
,
433 ServiceWorkerFetchEventResult result
,
434 const ServiceWorkerResponse
& response
);
435 void OnSyncEventFinished(int request_id
, ServiceWorkerEventStatus status
);
436 void OnNotificationClickEventFinished(int request_id
);
437 void OnPushEventFinished(int request_id
,
438 blink::WebServiceWorkerEventResult result
);
439 void OnGeofencingEventFinished(int request_id
);
440 void OnServicePortConnectEventFinished(int request_id
,
441 ServicePortConnectResult result
,
442 const mojo::String
& name
,
443 const mojo::String
& data
);
444 void OnOpenWindow(int request_id
, GURL url
);
445 void DidOpenWindow(int request_id
,
446 int render_process_id
,
447 int render_frame_id
);
448 void OnOpenWindowFinished(int request_id
,
449 const std::string
& client_uuid
,
450 const ServiceWorkerClientInfo
& client_info
);
452 void OnSetCachedMetadata(const GURL
& url
, const std::vector
<char>& data
);
453 void OnSetCachedMetadataFinished(int64 callback_id
, int result
);
454 void OnClearCachedMetadata(const GURL
& url
);
455 void OnClearCachedMetadataFinished(int64 callback_id
, int result
);
457 void OnPostMessageToClient(
458 const std::string
& client_uuid
,
459 const base::string16
& message
,
460 const std::vector
<TransferredMessagePort
>& sent_message_ports
);
461 void OnFocusClient(int request_id
, const std::string
& client_uuid
);
462 void OnSkipWaiting(int request_id
);
463 void OnClaimClients(int request_id
);
464 void OnPongFromWorker();
466 void OnFocusClientFinished(int request_id
,
467 const std::string
& client_uuid
,
468 const ServiceWorkerClientInfo
& client
);
470 void DidEnsureLiveRegistrationForStartWorker(
471 const StatusCallback
& callback
,
472 ServiceWorkerStatusCode status
,
473 const scoped_refptr
<ServiceWorkerRegistration
>& protect
);
474 void StartWorkerInternal();
476 void DidSkipWaiting(int request_id
);
478 void GetWindowClients(int request_id
,
479 const ServiceWorkerClientQueryOptions
& options
);
480 const std::vector
<base::Tuple
<int, int, std::string
>>
481 GetWindowClientsInternal(bool include_uncontolled
);
482 void DidGetWindowClients(int request_id
,
483 const ServiceWorkerClientQueryOptions
& options
,
484 scoped_ptr
<ServiceWorkerClients
> clients
);
485 void GetNonWindowClients(int request_id
,
486 const ServiceWorkerClientQueryOptions
& options
,
487 ServiceWorkerClients
* clients
);
488 void OnGetClientsFinished(int request_id
,
489 const ServiceWorkerClients
& clients
);
491 // The timeout timer periodically calls OnTimeoutTimer, which stops the worker
492 // if it is excessively idle or unresponsive to ping.
493 void StartTimeoutTimer();
494 void StopTimeoutTimer();
495 void OnTimeoutTimer();
497 // Called by PingController for ping protocol.
498 ServiceWorkerStatusCode
PingWorker();
499 void OnPingTimeout();
501 // Stops the worker if it is idle (has no in-flight requests) or timed out
503 void StopWorkerIfIdle();
504 bool HasInflightRequests() const;
506 // RecordStartWorkerResult is added as a start callback by StartTimeoutTimer
507 // and records metrics about startup.
508 void RecordStartWorkerResult(ServiceWorkerStatusCode status
);
510 template <typename IDMAP
>
511 void RemoveCallbackAndStopIfRedundant(IDMAP
* callbacks
, int request_id
);
513 template <typename CallbackType
>
515 const CallbackType
& callback
,
516 IDMap
<PendingRequest
<CallbackType
>, IDMapOwnPointer
>* callback_map
,
517 RequestType request_type
);
519 bool OnRequestTimeout(const RequestInfo
& info
);
520 void SetAllRequestTimes(const base::TimeTicks
& ticks
);
522 // Returns the reason the embedded worker failed to start, using information
523 // inaccessible to EmbeddedWorkerInstance. Returns |default_code| if it can't
525 ServiceWorkerStatusCode
DeduceStartWorkerFailureReason(
526 ServiceWorkerStatusCode default_code
);
528 // Sets |stale_time_| if this worker is stale, causing an update to eventually
529 // occur once the worker stops or is running too long.
532 void FoundRegistrationForUpdate(
533 ServiceWorkerStatusCode status
,
534 const scoped_refptr
<ServiceWorkerRegistration
>& registration
);
536 void OnStoppedInternal(EmbeddedWorkerInstance::Status old_status
);
538 // Called when a connection to a mojo event Dispatcher drops or fails.
539 // Calls callbacks for any outstanding requests to the dispatcher as well
540 // as cleans up the dispatcher.
541 void OnServicePortDispatcherConnectionError();
542 void OnBackgroundSyncDispatcherConnectionError();
544 const int64 version_id_
;
545 const int64 registration_id_
;
546 const GURL script_url_
;
549 Status status_
= NEW
;
550 scoped_ptr
<EmbeddedWorkerInstance
> embedded_worker_
;
551 std::vector
<StatusCallback
> start_callbacks_
;
552 std::vector
<StatusCallback
> stop_callbacks_
;
553 std::vector
<base::Closure
> status_change_callbacks_
;
555 // Message callbacks. (Update HasInflightRequests() too when you update this
557 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
> activate_requests_
;
558 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
> install_requests_
;
559 IDMap
<PendingRequest
<FetchCallback
>, IDMapOwnPointer
> fetch_requests_
;
560 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
> sync_requests_
;
561 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
>
562 notification_click_requests_
;
563 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
> push_requests_
;
564 IDMap
<PendingRequest
<StatusCallback
>, IDMapOwnPointer
> geofencing_requests_
;
565 IDMap
<PendingRequest
<ServicePortConnectCallback
>, IDMapOwnPointer
>
566 service_port_connect_requests_
;
568 ServicePortDispatcherPtr service_port_dispatcher_
;
569 BackgroundSyncServiceClientPtr background_sync_dispatcher_
;
571 std::set
<const ServiceWorkerURLRequestJob
*> streaming_url_request_jobs_
;
573 std::map
<std::string
, ServiceWorkerProviderHost
*> controllee_map_
;
574 // Will be null while shutting down.
575 base::WeakPtr
<ServiceWorkerContextCore
> context_
;
576 base::ObserverList
<Listener
> listeners_
;
577 ServiceWorkerScriptCacheMap script_cache_map_
;
578 base::OneShotTimer
<ServiceWorkerVersion
> update_timer_
;
580 // Starts running in StartWorker and continues until the worker is stopped.
581 base::RepeatingTimer
<ServiceWorkerVersion
> timeout_timer_
;
582 // Holds the time the worker last started being considered idle.
583 base::TimeTicks idle_time_
;
584 // Holds the time that the outstanding StartWorker() request started.
585 base::TimeTicks start_time_
;
586 // Holds the time the worker entered STOPPING status.
587 base::TimeTicks stop_time_
;
588 // Holds the time the worker was detected as stale and needs updating. We try
589 // to update once the worker stops, but will also update if it stays alive too
591 base::TimeTicks stale_time_
;
593 // New requests are added to |requests_| along with their entry in a callback
594 // map. The timeout timer periodically checks |requests_| for entries that
595 // should time out or have already been fulfilled (i.e., removed from the
597 std::queue
<RequestInfo
> requests_
;
599 bool skip_waiting_
= false;
600 bool skip_recording_startup_time_
= false;
601 bool force_bypass_cache_for_scripts_
= false;
602 bool is_update_scheduled_
= false;
604 std::vector
<int> pending_skip_waiting_requests_
;
605 scoped_ptr
<net::HttpResponseInfo
> main_script_http_info_
;
607 // The status when StartWorker was invoked. Used for UMA.
608 Status prestart_status_
= NEW
;
609 // If not OK, the reason that StartWorker failed. Used for
610 // running |start_callbacks_|.
611 ServiceWorkerStatusCode start_worker_status_
= SERVICE_WORKER_OK
;
613 scoped_ptr
<PingController
> ping_controller_
;
614 scoped_ptr
<Metrics
> metrics_
;
616 base::WeakPtrFactory
<ServiceWorkerVersion
> weak_factory_
;
618 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion
);
621 } // namespace content
623 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_