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 <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 } | 1343 } |
1344 } | 1344 } |
1345 | 1345 |
1346 void ServiceWorkerVersion::StartWorkerInternal() { | 1346 void ServiceWorkerVersion::StartWorkerInternal() { |
1347 if (!metrics_) | 1347 if (!metrics_) |
1348 metrics_.reset(new Metrics(this)); | 1348 metrics_.reset(new Metrics(this)); |
1349 | 1349 |
1350 if (!timeout_timer_.IsRunning()) | 1350 if (!timeout_timer_.IsRunning()) |
1351 StartTimeoutTimer(); | 1351 StartTimeoutTimer(); |
1352 if (running_status() == STOPPED) { | 1352 if (running_status() == STOPPED) { |
| 1353 DCHECK(!pause_after_download_ || !IsInstalled(status())); |
1353 embedded_worker_->Start( | 1354 embedded_worker_->Start( |
1354 version_id_, scope_, script_url_, | 1355 version_id_, scope_, script_url_, |
1355 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, | 1356 base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, |
1356 weak_factory_.GetWeakPtr())); | 1357 weak_factory_.GetWeakPtr()), |
| 1358 pause_after_download_); |
1357 } | 1359 } |
1358 } | 1360 } |
1359 | 1361 |
1360 void ServiceWorkerVersion::StartTimeoutTimer() { | 1362 void ServiceWorkerVersion::StartTimeoutTimer() { |
1361 DCHECK(!timeout_timer_.IsRunning()); | 1363 DCHECK(!timeout_timer_.IsRunning()); |
1362 | 1364 |
1363 if (embedded_worker_->devtools_attached()) { | 1365 if (embedded_worker_->devtools_attached()) { |
1364 // Don't record the startup time metric once DevTools is attached. | 1366 // Don't record the startup time metric once DevTools is attached. |
1365 ClearTick(&start_time_); | 1367 ClearTick(&start_time_); |
1366 skip_recording_startup_time_ = true; | 1368 skip_recording_startup_time_ = true; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 void ServiceWorkerVersion::OnBeginEvent() { | 1754 void ServiceWorkerVersion::OnBeginEvent() { |
1753 if (should_exclude_from_uma_ || running_status() != RUNNING || | 1755 if (should_exclude_from_uma_ || running_status() != RUNNING || |
1754 idle_time_.is_null()) { | 1756 idle_time_.is_null()) { |
1755 return; | 1757 return; |
1756 } | 1758 } |
1757 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - | 1759 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - |
1758 idle_time_); | 1760 idle_time_); |
1759 } | 1761 } |
1760 | 1762 |
1761 } // namespace content | 1763 } // namespace content |
OLD | NEW |