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

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

Issue 2251633002: Use tri-state enum for the existence of Fetch Handler in ServiceWorkerVersion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 #include "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 embedded_worker_->RemoveListener(this); 342 embedded_worker_->RemoveListener(this);
343 } 343 }
344 344
345 void ServiceWorkerVersion::SetStatus(Status status) { 345 void ServiceWorkerVersion::SetStatus(Status status) {
346 if (status_ == status) 346 if (status_ == status)
347 return; 347 return;
348 348
349 TRACE_EVENT2("ServiceWorker", "ServiceWorkerVersion::SetStatus", "Script URL", 349 TRACE_EVENT2("ServiceWorker", "ServiceWorkerVersion::SetStatus", "Script URL",
350 script_url_.spec(), "New Status", VersionStatusToString(status)); 350 script_url_.spec(), "New Status", VersionStatusToString(status));
351 351
352 // |has_fetch_handler_| must be set before setting the status to INSTALLED,
353 // ACTIVATING or ACTIVATED.
354 DCHECK(has_fetch_handler_ ||
355 !(status == INSTALLED || status == ACTIVATING || status == ACTIVATED));
356
352 status_ = status; 357 status_ = status;
353 if (skip_waiting_ && status_ == ACTIVATED) { 358 if (skip_waiting_ && status_ == ACTIVATED) {
354 for (int request_id : pending_skip_waiting_requests_) 359 for (int request_id : pending_skip_waiting_requests_)
355 DidSkipWaiting(request_id); 360 DidSkipWaiting(request_id);
356 pending_skip_waiting_requests_.clear(); 361 pending_skip_waiting_requests_.clear();
357 } 362 }
358 363
359 // OnVersionStateChanged() invokes updates of the status using state 364 // OnVersionStateChanged() invokes updates of the status using state
360 // change IPC at ServiceWorkerHandle (for JS-land on renderer process) and 365 // change IPC at ServiceWorkerHandle (for JS-land on renderer process) and
361 // ServiceWorkerContextCore (for devtools and serviceworker-internals). 366 // ServiceWorkerContextCore (for devtools and serviceworker-internals).
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - 1762 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() -
1758 idle_time_); 1763 idle_time_);
1759 } 1764 }
1760 1765
1761 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) { 1766 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) {
1762 start_worker_first_purpose_ = base::nullopt; 1767 start_worker_first_purpose_ = base::nullopt;
1763 RunCallbacks(this, &start_callbacks_, status); 1768 RunCallbacks(this, &start_callbacks_, status);
1764 } 1769 }
1765 1770
1766 } // namespace content 1771 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698