Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_service_worker_helper.cc

Issue 2826783003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/browsing_data (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <tuple>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 15 matching lines...) Expand all
26 DCHECK(!callback.is_null()); 26 DCHECK(!callback.is_null());
27 27
28 std::list<ServiceWorkerUsageInfo> result; 28 std::list<ServiceWorkerUsageInfo> result;
29 for (const ServiceWorkerUsageInfo& origin : origins) { 29 for (const ServiceWorkerUsageInfo& origin : origins) {
30 if (!BrowsingDataHelper::HasWebScheme(origin.origin)) 30 if (!BrowsingDataHelper::HasWebScheme(origin.origin))
31 continue; // Non-websafe state is not considered browsing data. 31 continue; // Non-websafe state is not considered browsing data.
32 result.push_back(origin); 32 result.push_back(origin);
33 } 33 }
34 34
35 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 35 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
36 base::Bind(callback, result)); 36 base::BindOnce(callback, result));
37 } 37 }
38 38
39 void EmptySuccessCallback(bool success) {} 39 void EmptySuccessCallback(bool success) {}
40 40
41 } // namespace 41 } // namespace
42 42
43 BrowsingDataServiceWorkerHelper::BrowsingDataServiceWorkerHelper( 43 BrowsingDataServiceWorkerHelper::BrowsingDataServiceWorkerHelper(
44 ServiceWorkerContext* service_worker_context) 44 ServiceWorkerContext* service_worker_context)
45 : service_worker_context_(service_worker_context) { 45 : service_worker_context_(service_worker_context) {
46 DCHECK(service_worker_context_); 46 DCHECK(service_worker_context_);
47 } 47 }
48 48
49 BrowsingDataServiceWorkerHelper::~BrowsingDataServiceWorkerHelper() {} 49 BrowsingDataServiceWorkerHelper::~BrowsingDataServiceWorkerHelper() {}
50 50
51 void BrowsingDataServiceWorkerHelper::StartFetching( 51 void BrowsingDataServiceWorkerHelper::StartFetching(
52 const FetchCallback& callback) { 52 const FetchCallback& callback) {
53 DCHECK_CURRENTLY_ON(BrowserThread::UI); 53 DCHECK_CURRENTLY_ON(BrowserThread::UI);
54 DCHECK(!callback.is_null()); 54 DCHECK(!callback.is_null());
55 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 55 BrowserThread::PostTask(
56 base::Bind(&BrowsingDataServiceWorkerHelper:: 56 BrowserThread::IO, FROM_HERE,
57 FetchServiceWorkerUsageInfoOnIOThread, 57 base::BindOnce(&BrowsingDataServiceWorkerHelper::
58 this, callback)); 58 FetchServiceWorkerUsageInfoOnIOThread,
59 this, callback));
59 } 60 }
60 61
61 void BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(const GURL& origin) { 62 void BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(const GURL& origin) {
62 DCHECK_CURRENTLY_ON(BrowserThread::UI); 63 DCHECK_CURRENTLY_ON(BrowserThread::UI);
63 BrowserThread::PostTask( 64 BrowserThread::PostTask(
64 BrowserThread::IO, 65 BrowserThread::IO, FROM_HERE,
65 FROM_HERE, 66 base::BindOnce(
66 base::Bind(
67 &BrowsingDataServiceWorkerHelper::DeleteServiceWorkersOnIOThread, 67 &BrowsingDataServiceWorkerHelper::DeleteServiceWorkersOnIOThread,
68 this, 68 this, origin));
69 origin));
70 } 69 }
71 70
72 void BrowsingDataServiceWorkerHelper::FetchServiceWorkerUsageInfoOnIOThread( 71 void BrowsingDataServiceWorkerHelper::FetchServiceWorkerUsageInfoOnIOThread(
73 const FetchCallback& callback) { 72 const FetchCallback& callback) {
74 DCHECK_CURRENTLY_ON(BrowserThread::IO); 73 DCHECK_CURRENTLY_ON(BrowserThread::IO);
75 DCHECK(!callback.is_null()); 74 DCHECK(!callback.is_null());
76 75
77 service_worker_context_->GetAllOriginsInfo( 76 service_worker_context_->GetAllOriginsInfo(
78 base::Bind(&GetAllOriginsInfoCallback, callback)); 77 base::Bind(&GetAllOriginsInfoCallback, callback));
79 } 78 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 DCHECK_CURRENTLY_ON(BrowserThread::UI); 144 DCHECK_CURRENTLY_ON(BrowserThread::UI);
146 DCHECK(!callback.is_null()); 145 DCHECK(!callback.is_null());
147 146
148 std::list<ServiceWorkerUsageInfo> result; 147 std::list<ServiceWorkerUsageInfo> result;
149 for (const PendingServiceWorkerUsageInfo& pending_info : 148 for (const PendingServiceWorkerUsageInfo& pending_info :
150 pending_service_worker_info_) { 149 pending_service_worker_info_) {
151 ServiceWorkerUsageInfo info(pending_info.origin, pending_info.scopes); 150 ServiceWorkerUsageInfo info(pending_info.origin, pending_info.scopes);
152 result.push_back(info); 151 result.push_back(info);
153 } 152 }
154 153
155 BrowserThread::PostTask( 154 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
156 BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); 155 base::BindOnce(callback, result));
157 } 156 }
158 157
159 void CannedBrowsingDataServiceWorkerHelper::DeleteServiceWorkers( 158 void CannedBrowsingDataServiceWorkerHelper::DeleteServiceWorkers(
160 const GURL& origin) { 159 const GURL& origin) {
161 for (std::set<PendingServiceWorkerUsageInfo>::iterator it = 160 for (std::set<PendingServiceWorkerUsageInfo>::iterator it =
162 pending_service_worker_info_.begin(); 161 pending_service_worker_info_.begin();
163 it != pending_service_worker_info_.end();) { 162 it != pending_service_worker_info_.end();) {
164 if (it->origin == origin) 163 if (it->origin == origin)
165 pending_service_worker_info_.erase(it++); 164 pending_service_worker_info_.erase(it++);
166 else 165 else
167 ++it; 166 ++it;
168 } 167 }
169 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin); 168 BrowsingDataServiceWorkerHelper::DeleteServiceWorkers(origin);
170 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698