| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" |
| 6 | 6 |
| 7 #include <tuple> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/location.h" | 11 #include "base/location.h" |
| 11 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 12 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/service_worker_context.h" | 14 #include "content/public/browser/service_worker_context.h" |
| 14 | 15 |
| 15 using content::BrowserThread; | 16 using content::BrowserThread; |
| 16 using content::ServiceWorkerContext; | 17 using content::ServiceWorkerContext; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 const std::vector<GURL>& scopes) | 90 const std::vector<GURL>& scopes) |
| 90 : origin(origin), scopes(scopes) { | 91 : origin(origin), scopes(scopes) { |
| 91 } | 92 } |
| 92 | 93 |
| 93 CannedBrowsingDataServiceWorkerHelper::PendingServiceWorkerUsageInfo:: | 94 CannedBrowsingDataServiceWorkerHelper::PendingServiceWorkerUsageInfo:: |
| 94 ~PendingServiceWorkerUsageInfo() { | 95 ~PendingServiceWorkerUsageInfo() { |
| 95 } | 96 } |
| 96 | 97 |
| 97 bool CannedBrowsingDataServiceWorkerHelper::PendingServiceWorkerUsageInfo:: | 98 bool CannedBrowsingDataServiceWorkerHelper::PendingServiceWorkerUsageInfo:: |
| 98 operator<(const PendingServiceWorkerUsageInfo& other) const { | 99 operator<(const PendingServiceWorkerUsageInfo& other) const { |
| 99 if (origin == other.origin) | 100 return std::tie(origin, scopes) < std::tie(other.origin, other.scopes); |
| 100 return scopes < other.scopes; | |
| 101 return origin < other.origin; | |
| 102 } | 101 } |
| 103 | 102 |
| 104 CannedBrowsingDataServiceWorkerHelper::CannedBrowsingDataServiceWorkerHelper( | 103 CannedBrowsingDataServiceWorkerHelper::CannedBrowsingDataServiceWorkerHelper( |
| 105 content::ServiceWorkerContext* context) | 104 content::ServiceWorkerContext* context) |
| 106 : BrowsingDataServiceWorkerHelper(context) { | 105 : BrowsingDataServiceWorkerHelper(context) { |
| 107 } | 106 } |
| 108 | 107 |
| 109 CannedBrowsingDataServiceWorkerHelper:: | 108 CannedBrowsingDataServiceWorkerHelper:: |
| 110 ~CannedBrowsingDataServiceWorkerHelper() { | 109 ~CannedBrowsingDataServiceWorkerHelper() { |
| 111 } | 110 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 for (std::set<PendingServiceWorkerUsageInfo>::iterator it = | 157 for (std::set<PendingServiceWorkerUsageInfo>::iterator it = |
| 159 pending_service_worker_info_.begin(); | 158 pending_service_worker_info_.begin(); |
| 160 it != pending_service_worker_info_.end();) { | 159 it != pending_service_worker_info_.end();) { |
| 161 if (it->origin == origin) | 160 if (it->origin == origin) |
| 162 pending_service_worker_info_.erase(it++); | 161 pending_service_worker_info_.erase(it++); |
| 163 else | 162 else |
| 164 ++it; | 163 ++it; |
| 165 } | 164 } |
| 166 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin); | 165 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin); |
| 167 } | 166 } |
| OLD | NEW |