Chromium Code Reviews| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 EmbeddedWorkerStatus running_status() const { | 132 EmbeddedWorkerStatus running_status() const { |
| 133 return embedded_worker_->status(); | 133 return embedded_worker_->status(); |
| 134 } | 134 } |
| 135 ServiceWorkerVersionInfo GetInfo(); | 135 ServiceWorkerVersionInfo GetInfo(); |
| 136 Status status() const { return status_; } | 136 Status status() const { return status_; } |
| 137 | 137 |
| 138 // This flag is set when the install event has been executed in a new version | 138 // This flag is set when the install event has been executed in a new version |
| 139 // or when an installed version is loaded from the storage. When a new version | 139 // or when an installed version is loaded from the storage. When a new version |
| 140 // is not installed yet, returns base::nullopt. | 140 // is not installed yet, returns base::nullopt. |
| 141 base::Optional<bool> has_fetch_handler() const { return has_fetch_handler_; } | 141 base::Optional<bool> has_fetch_handler() const { return has_fetch_handler_; } |
| 142 void set_has_fetch_handler(bool has_fetch_handler) { | 142 // This also updates |site_for_uma_| when it was Site::OTHER. |
| 143 DCHECK(!has_fetch_handler_); | 143 void set_has_fetch_handler(bool has_fetch_handler); |
| 144 has_fetch_handler_ = has_fetch_handler; | |
| 145 } | |
| 146 | 144 |
| 147 const std::vector<GURL>& foreign_fetch_scopes() const { | 145 const std::vector<GURL>& foreign_fetch_scopes() const { |
| 148 return foreign_fetch_scopes_; | 146 return foreign_fetch_scopes_; |
| 149 } | 147 } |
| 150 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { | 148 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { |
| 151 foreign_fetch_scopes_ = scopes; | 149 foreign_fetch_scopes_ = scopes; |
| 152 } | 150 } |
| 153 | 151 |
| 154 const std::vector<url::Origin>& foreign_fetch_origins() const { | 152 const std::vector<url::Origin>& foreign_fetch_origins() const { |
| 155 return foreign_fetch_origins_; | 153 return foreign_fetch_origins_; |
| 156 } | 154 } |
| 157 void set_foreign_fetch_origins(const std::vector<url::Origin>& origins) { | 155 void set_foreign_fetch_origins(const std::vector<url::Origin>& origins) { |
| 158 foreign_fetch_origins_ = origins; | 156 foreign_fetch_origins_ = origins; |
| 159 } | 157 } |
| 160 | 158 |
| 159 ServiceWorkerMetrics::Site site_for_uma() const { return site_for_uma_; } | |
|
shimazu
2016/08/18 04:47:36
I think storing Site as |site_for_uma_| is adding
horo
2016/08/18 05:44:54
We will use this Site for UMA of all fetch events.
shimazu
2016/08/18 06:53:24
I see. Let's follow HistogramCustomizer:)
# The r
| |
| 160 | |
| 161 // This sets the new status and also run status change callbacks | 161 // This sets the new status and also run status change callbacks |
| 162 // if there're any (see RegisterStatusChangeCallback). | 162 // if there're any (see RegisterStatusChangeCallback). |
| 163 void SetStatus(Status status); | 163 void SetStatus(Status status); |
| 164 | 164 |
| 165 // Registers status change callback. (This is for one-off observation, | 165 // Registers status change callback. (This is for one-off observation, |
| 166 // the consumer needs to re-register if it wants to continue observing | 166 // the consumer needs to re-register if it wants to continue observing |
| 167 // status changes) | 167 // status changes) |
| 168 void RegisterStatusChangeCallback(const base::Closure& callback); | 168 void RegisterStatusChangeCallback(const base::Closure& callback); |
| 169 | 169 |
| 170 // Starts an embedded worker for this version. | 170 // Starts an embedded worker for this version. |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 void FinishStartWorker(ServiceWorkerStatusCode status); | 663 void FinishStartWorker(ServiceWorkerStatusCode status); |
| 664 | 664 |
| 665 const int64_t version_id_; | 665 const int64_t version_id_; |
| 666 const int64_t registration_id_; | 666 const int64_t registration_id_; |
| 667 const GURL script_url_; | 667 const GURL script_url_; |
| 668 const GURL scope_; | 668 const GURL scope_; |
| 669 std::vector<GURL> foreign_fetch_scopes_; | 669 std::vector<GURL> foreign_fetch_scopes_; |
| 670 std::vector<url::Origin> foreign_fetch_origins_; | 670 std::vector<url::Origin> foreign_fetch_origins_; |
| 671 base::Optional<bool> has_fetch_handler_; | 671 base::Optional<bool> has_fetch_handler_; |
| 672 | 672 |
| 673 ServiceWorkerMetrics::Site site_for_uma_; | |
| 674 | |
| 673 Status status_ = NEW; | 675 Status status_ = NEW; |
| 674 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; | 676 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; |
| 675 std::vector<StatusCallback> start_callbacks_; | 677 std::vector<StatusCallback> start_callbacks_; |
| 676 std::vector<StatusCallback> stop_callbacks_; | 678 std::vector<StatusCallback> stop_callbacks_; |
| 677 std::vector<base::Closure> status_change_callbacks_; | 679 std::vector<base::Closure> status_change_callbacks_; |
| 678 | 680 |
| 679 // Holds in-flight requests, including requests due to outstanding push, | 681 // Holds in-flight requests, including requests due to outstanding push, |
| 680 // fetch, sync, etc. events. | 682 // fetch, sync, etc. events. |
| 681 IDMap<PendingRequest, IDMapOwnPointer> pending_requests_; | 683 IDMap<PendingRequest, IDMapOwnPointer> pending_requests_; |
| 682 | 684 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 | 820 |
| 819 // At this point |this| can have been deleted, so don't do anything other | 821 // At this point |this| can have been deleted, so don't do anything other |
| 820 // than returning. | 822 // than returning. |
| 821 | 823 |
| 822 return true; | 824 return true; |
| 823 } | 825 } |
| 824 | 826 |
| 825 } // namespace content | 827 } // namespace content |
| 826 | 828 |
| 827 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 829 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |