Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: content/browser/service_worker/service_worker_version.h

Issue 2250623003: Keep ServiceWorkerMetrics::Site in ServiceWorkerVersion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 ServiceWorkerVersionInfo GetInfo(); 142 ServiceWorkerVersionInfo GetInfo();
143 Status status() const { return status_; } 143 Status status() const { return status_; }
144 144
145 // This status is set to EXISTS or DOES_NOT_EXIST when the install event has 145 // This status is set to EXISTS or DOES_NOT_EXIST when the install event has
146 // been executed in a new version or when an installed version is loaded from 146 // been executed in a new version or when an installed version is loaded from
147 // the storage. When a new version is not installed yet, it is UNKNOW. 147 // the storage. When a new version is not installed yet, it is UNKNOW.
148 FetchHandlerExistence fetch_handler_existence() const { 148 FetchHandlerExistence fetch_handler_existence() const {
149 return fetch_handler_existence_; 149 return fetch_handler_existence_;
150 } 150 }
151 void set_fetch_handler_existence(FetchHandlerExistence existence) { 151 // This also updates |site_for_uma_| when it was Site::OTHER.
152 DCHECK_EQ(fetch_handler_existence_, FetchHandlerExistence::UNKNOWN); 152 void set_fetch_handler_existence(FetchHandlerExistence existence);
153 DCHECK_NE(existence, FetchHandlerExistence::UNKNOWN); 153
154 fetch_handler_existence_ = existence; 154 bool should_exclude_from_uma() const { return should_exclude_from_uma_; }
155 }
156 155
157 const std::vector<GURL>& foreign_fetch_scopes() const { 156 const std::vector<GURL>& foreign_fetch_scopes() const {
158 return foreign_fetch_scopes_; 157 return foreign_fetch_scopes_;
159 } 158 }
160 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) { 159 void set_foreign_fetch_scopes(const std::vector<GURL>& scopes) {
161 foreign_fetch_scopes_ = scopes; 160 foreign_fetch_scopes_ = scopes;
162 } 161 }
163 162
164 const std::vector<url::Origin>& foreign_fetch_origins() const { 163 const std::vector<url::Origin>& foreign_fetch_origins() const {
165 return foreign_fetch_origins_; 164 return foreign_fetch_origins_;
166 } 165 }
167 void set_foreign_fetch_origins(const std::vector<url::Origin>& origins) { 166 void set_foreign_fetch_origins(const std::vector<url::Origin>& origins) {
168 foreign_fetch_origins_ = origins; 167 foreign_fetch_origins_ = origins;
169 } 168 }
170 169
170 ServiceWorkerMetrics::Site site_for_uma() const { return site_for_uma_; }
171
171 // This sets the new status and also run status change callbacks 172 // This sets the new status and also run status change callbacks
172 // if there're any (see RegisterStatusChangeCallback). 173 // if there're any (see RegisterStatusChangeCallback).
173 void SetStatus(Status status); 174 void SetStatus(Status status);
174 175
175 // Registers status change callback. (This is for one-off observation, 176 // Registers status change callback. (This is for one-off observation,
176 // the consumer needs to re-register if it wants to continue observing 177 // the consumer needs to re-register if it wants to continue observing
177 // status changes) 178 // status changes)
178 void RegisterStatusChangeCallback(const base::Closure& callback); 179 void RegisterStatusChangeCallback(const base::Closure& callback);
179 180
180 // Starts an embedded worker for this version. 181 // Starts an embedded worker for this version.
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // callbacks. 673 // callbacks.
673 void FinishStartWorker(ServiceWorkerStatusCode status); 674 void FinishStartWorker(ServiceWorkerStatusCode status);
674 675
675 const int64_t version_id_; 676 const int64_t version_id_;
676 const int64_t registration_id_; 677 const int64_t registration_id_;
677 const GURL script_url_; 678 const GURL script_url_;
678 const GURL scope_; 679 const GURL scope_;
679 std::vector<GURL> foreign_fetch_scopes_; 680 std::vector<GURL> foreign_fetch_scopes_;
680 std::vector<url::Origin> foreign_fetch_origins_; 681 std::vector<url::Origin> foreign_fetch_origins_;
681 FetchHandlerExistence fetch_handler_existence_; 682 FetchHandlerExistence fetch_handler_existence_;
683 ServiceWorkerMetrics::Site site_for_uma_;
682 684
683 Status status_ = NEW; 685 Status status_ = NEW;
684 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; 686 std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_;
685 std::vector<StatusCallback> start_callbacks_; 687 std::vector<StatusCallback> start_callbacks_;
686 std::vector<StatusCallback> stop_callbacks_; 688 std::vector<StatusCallback> stop_callbacks_;
687 std::vector<base::Closure> status_change_callbacks_; 689 std::vector<base::Closure> status_change_callbacks_;
688 690
689 // Holds in-flight requests, including requests due to outstanding push, 691 // Holds in-flight requests, including requests due to outstanding push,
690 // fetch, sync, etc. events. 692 // fetch, sync, etc. events.
691 IDMap<PendingRequest, IDMapOwnPointer> pending_requests_; 693 IDMap<PendingRequest, IDMapOwnPointer> pending_requests_;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 830
829 // At this point |this| can have been deleted, so don't do anything other 831 // At this point |this| can have been deleted, so don't do anything other
830 // than returning. 832 // than returning.
831 833
832 return true; 834 return true;
833 } 835 }
834 836
835 } // namespace content 837 } // namespace content
836 838
837 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ 839 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698