| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 DidSkipWaiting(request_id); | 341 DidSkipWaiting(request_id); |
| 342 pending_skip_waiting_requests_.clear(); | 342 pending_skip_waiting_requests_.clear(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 std::vector<base::Closure> callbacks; | 345 std::vector<base::Closure> callbacks; |
| 346 callbacks.swap(status_change_callbacks_); | 346 callbacks.swap(status_change_callbacks_); |
| 347 for (const auto& callback : callbacks) | 347 for (const auto& callback : callbacks) |
| 348 callback.Run(); | 348 callback.Run(); |
| 349 | 349 |
| 350 FOR_EACH_OBSERVER(Listener, listeners_, OnVersionStateChanged(this)); | 350 FOR_EACH_OBSERVER(Listener, listeners_, OnVersionStateChanged(this)); |
| 351 |
| 352 if (status == INSTALLED) |
| 353 embedded_worker_->OnWorkerVersionInstalled(); |
| 354 else if (status == REDUNDANT) |
| 355 embedded_worker_->OnWorkerVersionDoomed(); |
| 351 } | 356 } |
| 352 | 357 |
| 353 void ServiceWorkerVersion::RegisterStatusChangeCallback( | 358 void ServiceWorkerVersion::RegisterStatusChangeCallback( |
| 354 const base::Closure& callback) { | 359 const base::Closure& callback) { |
| 355 status_change_callbacks_.push_back(callback); | 360 status_change_callbacks_.push_back(callback); |
| 356 } | 361 } |
| 357 | 362 |
| 358 ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() { | 363 ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() { |
| 359 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 364 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 360 ServiceWorkerVersionInfo info( | 365 ServiceWorkerVersionInfo info( |
| (...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1687 void ServiceWorkerVersion::OnBeginEvent() { | 1692 void ServiceWorkerVersion::OnBeginEvent() { |
| 1688 if (should_exclude_from_uma_ || running_status() != RUNNING || | 1693 if (should_exclude_from_uma_ || running_status() != RUNNING || |
| 1689 idle_time_.is_null()) { | 1694 idle_time_.is_null()) { |
| 1690 return; | 1695 return; |
| 1691 } | 1696 } |
| 1692 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - | 1697 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - |
| 1693 idle_time_); | 1698 idle_time_); |
| 1694 } | 1699 } |
| 1695 | 1700 |
| 1696 } // namespace content | 1701 } // namespace content |
| OLD | NEW |