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 #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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 scope_(registration->pattern()), | 298 scope_(registration->pattern()), |
299 context_(context), | 299 context_(context), |
300 script_cache_map_(this, context), | 300 script_cache_map_(this, context), |
301 ping_controller_(new PingController(this)), | 301 ping_controller_(new PingController(this)), |
302 should_exclude_from_uma_( | 302 should_exclude_from_uma_( |
303 ServiceWorkerMetrics::ShouldExcludeURLFromHistogram(scope_)), | 303 ServiceWorkerMetrics::ShouldExcludeURLFromHistogram(scope_)), |
304 weak_factory_(this) { | 304 weak_factory_(this) { |
305 DCHECK_NE(kInvalidServiceWorkerVersionId, version_id); | 305 DCHECK_NE(kInvalidServiceWorkerVersionId, version_id); |
306 DCHECK(context_); | 306 DCHECK(context_); |
307 DCHECK(registration); | 307 DCHECK(registration); |
| 308 DCHECK(script_url_.is_valid()); |
308 context_->AddLiveVersion(this); | 309 context_->AddLiveVersion(this); |
309 embedded_worker_ = context_->embedded_worker_registry()->CreateWorker(); | 310 embedded_worker_ = context_->embedded_worker_registry()->CreateWorker(); |
310 embedded_worker_->AddListener(this); | 311 embedded_worker_->AddListener(this); |
311 } | 312 } |
312 | 313 |
313 ServiceWorkerVersion::~ServiceWorkerVersion() { | 314 ServiceWorkerVersion::~ServiceWorkerVersion() { |
314 in_dtor_ = true; | 315 in_dtor_ = true; |
315 | 316 |
316 // Record UMA if the worker was trying to start. One way we get here is if the | 317 // Record UMA if the worker was trying to start. One way we get here is if the |
317 // user closed the tab before the SW could start up. | 318 // user closed the tab before the SW could start up. |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 void ServiceWorkerVersion::OnBeginEvent() { | 1693 void ServiceWorkerVersion::OnBeginEvent() { |
1693 if (should_exclude_from_uma_ || running_status() != RUNNING || | 1694 if (should_exclude_from_uma_ || running_status() != RUNNING || |
1694 idle_time_.is_null()) { | 1695 idle_time_.is_null()) { |
1695 return; | 1696 return; |
1696 } | 1697 } |
1697 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - | 1698 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - |
1698 idle_time_); | 1699 idle_time_); |
1699 } | 1700 } |
1700 | 1701 |
1701 } // namespace content | 1702 } // namespace content |
OLD | NEW |