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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 return; | 1686 return; |
1687 std::vector<ServiceWorkerDatabase::ResourceRecord> resources; | 1687 std::vector<ServiceWorkerDatabase::ResourceRecord> resources; |
1688 script_cache_map_.GetResources(&resources); | 1688 script_cache_map_.GetResources(&resources); |
1689 context_->storage()->PurgeResources(resources); | 1689 context_->storage()->PurgeResources(resources); |
1690 } | 1690 } |
1691 | 1691 |
1692 template <typename IDMAP> | 1692 template <typename IDMAP> |
1693 void ServiceWorkerVersion::RemoveCallbackAndStopIfDoomed( | 1693 void ServiceWorkerVersion::RemoveCallbackAndStopIfDoomed( |
1694 IDMAP* callbacks, | 1694 IDMAP* callbacks, |
1695 int request_id) { | 1695 int request_id) { |
| 1696 RestartTick(&idle_time_); |
1696 callbacks->Remove(request_id); | 1697 callbacks->Remove(request_id); |
1697 if (is_doomed_) { | 1698 if (is_doomed_) { |
1698 // The stop should be already scheduled, but try to stop immediately, in | 1699 // The stop should be already scheduled, but try to stop immediately, in |
1699 // order to release worker resources soon. | 1700 // order to release worker resources soon. |
1700 StopWorkerIfIdle(); | 1701 StopWorkerIfIdle(); |
1701 } | 1702 } |
1702 } | 1703 } |
1703 | 1704 |
1704 template <typename CallbackType> | 1705 template <typename CallbackType> |
1705 int ServiceWorkerVersion::AddRequest( | 1706 int ServiceWorkerVersion::AddRequest( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 while (!requests_.empty()) { | 1751 while (!requests_.empty()) { |
1751 RequestInfo info = requests_.front(); | 1752 RequestInfo info = requests_.front(); |
1752 info.time = ticks; | 1753 info.time = ticks; |
1753 new_requests.push(info); | 1754 new_requests.push(info); |
1754 requests_.pop(); | 1755 requests_.pop(); |
1755 } | 1756 } |
1756 requests_ = new_requests; | 1757 requests_ = new_requests; |
1757 } | 1758 } |
1758 | 1759 |
1759 } // namespace content | 1760 } // namespace content |
OLD | NEW |