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_SERVICE_WORKER_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | 10 #include <set> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 ServiceWorkerProviderHost* provider_host) { | 116 ServiceWorkerProviderHost* provider_host) { |
117 } | 117 } |
118 // Fires when a version transitions from having a controllee to not. | 118 // Fires when a version transitions from having a controllee to not. |
119 virtual void OnNoControllees(ServiceWorkerVersion* version) {} | 119 virtual void OnNoControllees(ServiceWorkerVersion* version) {} |
120 virtual void OnCachedMetadataUpdated(ServiceWorkerVersion* version) {} | 120 virtual void OnCachedMetadataUpdated(ServiceWorkerVersion* version) {} |
121 | 121 |
122 protected: | 122 protected: |
123 virtual ~Listener() {} | 123 virtual ~Listener() {} |
124 }; | 124 }; |
125 | 125 |
126 ServiceWorkerVersion( | 126 ServiceWorkerVersion(ServiceWorkerRegistration* registration, |
127 ServiceWorkerRegistration* registration, | 127 const GURL& script_url, |
128 const GURL& script_url, | 128 std::string version_uuid, |
129 int64 version_id, | 129 base::WeakPtr<ServiceWorkerContextCore> context); |
130 base::WeakPtr<ServiceWorkerContextCore> context); | |
131 | 130 |
132 int64 version_id() const { return version_id_; } | 131 std::string version_uuid() const { return version_uuid_; } |
133 int64 registration_id() const { return registration_id_; } | 132 int64 registration_id() const { return registration_id_; } |
134 const GURL& script_url() const { return script_url_; } | 133 const GURL& script_url() const { return script_url_; } |
135 const GURL& scope() const { return scope_; } | 134 const GURL& scope() const { return scope_; } |
136 RunningStatus running_status() const { | 135 RunningStatus running_status() const { |
137 return static_cast<RunningStatus>(embedded_worker_->status()); | 136 return static_cast<RunningStatus>(embedded_worker_->status()); |
138 } | 137 } |
139 ServiceWorkerVersionInfo GetInfo(); | 138 ServiceWorkerVersionInfo GetInfo(); |
140 Status status() const { return status_; } | 139 Status status() const { return status_; } |
141 | 140 |
142 // This sets the new status and also run status change callbacks | 141 // This sets the new status and also run status change callbacks |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 ServiceWorkerStatusCode default_code); | 519 ServiceWorkerStatusCode default_code); |
521 | 520 |
522 // Sets |stale_time_| if this worker is stale, causing an update to eventually | 521 // Sets |stale_time_| if this worker is stale, causing an update to eventually |
523 // occur once the worker stops or is running too long. | 522 // occur once the worker stops or is running too long. |
524 void MarkIfStale(); | 523 void MarkIfStale(); |
525 | 524 |
526 void FoundRegistrationForUpdate( | 525 void FoundRegistrationForUpdate( |
527 ServiceWorkerStatusCode status, | 526 ServiceWorkerStatusCode status, |
528 const scoped_refptr<ServiceWorkerRegistration>& registration); | 527 const scoped_refptr<ServiceWorkerRegistration>& registration); |
529 | 528 |
530 const int64 version_id_; | 529 const std::string version_uuid_; |
531 const int64 registration_id_; | 530 const int64 registration_id_; |
532 const GURL script_url_; | 531 const GURL script_url_; |
533 const GURL scope_; | 532 const GURL scope_; |
534 | 533 |
535 Status status_ = NEW; | 534 Status status_ = NEW; |
536 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; | 535 scoped_ptr<EmbeddedWorkerInstance> embedded_worker_; |
537 std::vector<StatusCallback> start_callbacks_; | 536 std::vector<StatusCallback> start_callbacks_; |
538 std::vector<StatusCallback> stop_callbacks_; | 537 std::vector<StatusCallback> stop_callbacks_; |
539 std::vector<base::Closure> status_change_callbacks_; | 538 std::vector<base::Closure> status_change_callbacks_; |
540 | 539 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 scoped_ptr<Metrics> metrics_; | 593 scoped_ptr<Metrics> metrics_; |
595 | 594 |
596 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; | 595 base::WeakPtrFactory<ServiceWorkerVersion> weak_factory_; |
597 | 596 |
598 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); | 597 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerVersion); |
599 }; | 598 }; |
600 | 599 |
601 } // namespace content | 600 } // namespace content |
602 | 601 |
603 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 602 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |