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

Side by Side Diff: webkit/appcache/appcache_quota_client.cc

Issue 15925005: [Quota][Clean up] Drop non-informative StorageType parameter on GetOriginsForType callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/appcache/appcache_quota_client.h" 5 #include "webkit/appcache/appcache_quota_client.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const GetOriginsCallback& callback) { 99 const GetOriginsCallback& callback) {
100 GetOriginsHelper(type, std::string(), callback); 100 GetOriginsHelper(type, std::string(), callback);
101 } 101 }
102 102
103 void AppCacheQuotaClient::GetOriginsForHost( 103 void AppCacheQuotaClient::GetOriginsForHost(
104 quota::StorageType type, 104 quota::StorageType type,
105 const std::string& host, 105 const std::string& host,
106 const GetOriginsCallback& callback) { 106 const GetOriginsCallback& callback) {
107 DCHECK(!callback.is_null()); 107 DCHECK(!callback.is_null());
108 if (host.empty()) { 108 if (host.empty()) {
109 callback.Run(std::set<GURL>(), type); 109 callback.Run(std::set<GURL>());
110 return; 110 return;
111 } 111 }
112 GetOriginsHelper(type, host, callback); 112 GetOriginsHelper(type, host, callback);
113 } 113 }
114 114
115 void AppCacheQuotaClient::DeleteOriginData(const GURL& origin, 115 void AppCacheQuotaClient::DeleteOriginData(const GURL& origin,
116 quota::StorageType type, 116 quota::StorageType type,
117 const DeletionCallback& callback) { 117 const DeletionCallback& callback) {
118 DCHECK(!quota_manager_is_destroyed_); 118 DCHECK(!quota_manager_is_destroyed_);
119 119
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 void AppCacheQuotaClient::GetOriginsHelper( 157 void AppCacheQuotaClient::GetOriginsHelper(
158 quota::StorageType type, 158 quota::StorageType type,
159 const std::string& opt_host, 159 const std::string& opt_host,
160 const GetOriginsCallback& callback) { 160 const GetOriginsCallback& callback) {
161 DCHECK(!callback.is_null()); 161 DCHECK(!callback.is_null());
162 DCHECK(!quota_manager_is_destroyed_); 162 DCHECK(!quota_manager_is_destroyed_);
163 163
164 if (!service_) { 164 if (!service_) {
165 callback.Run(std::set<GURL>(), type); 165 callback.Run(std::set<GURL>());
166 return; 166 return;
167 } 167 }
168 168
169 if (!appcache_is_ready_) { 169 if (!appcache_is_ready_) {
170 pending_batch_requests_.push_back( 170 pending_batch_requests_.push_back(
171 base::Bind(&AppCacheQuotaClient::GetOriginsHelper, 171 base::Bind(&AppCacheQuotaClient::GetOriginsHelper,
172 base::Unretained(this), type, opt_host, callback)); 172 base::Unretained(this), type, opt_host, callback));
173 return; 173 return;
174 } 174 }
175 175
176 if (type != quota::kStorageTypeTemporary) { 176 if (type != quota::kStorageTypeTemporary) {
177 callback.Run(std::set<GURL>(), type); 177 callback.Run(std::set<GURL>());
178 return; 178 return;
179 } 179 }
180 180
181 const AppCacheStorage::UsageMap* map = GetUsageMap(); 181 const AppCacheStorage::UsageMap* map = GetUsageMap();
182 std::set<GURL> origins; 182 std::set<GURL> origins;
183 for (AppCacheStorage::UsageMap::const_iterator iter = map->begin(); 183 for (AppCacheStorage::UsageMap::const_iterator iter = map->begin();
184 iter != map->end(); ++iter) { 184 iter != map->end(); ++iter) {
185 if (opt_host.empty() || iter->first.host() == opt_host) 185 if (opt_host.empty() || iter->first.host() == opt_host)
186 origins.insert(iter->first); 186 origins.insert(iter->first);
187 } 187 }
188 callback.Run(origins, type); 188 callback.Run(origins);
189 } 189 }
190 190
191 void AppCacheQuotaClient::ProcessPendingRequests() { 191 void AppCacheQuotaClient::ProcessPendingRequests() {
192 DCHECK(appcache_is_ready_); 192 DCHECK(appcache_is_ready_);
193 while (!pending_batch_requests_.empty()) 193 while (!pending_batch_requests_.empty())
194 RunFront(&pending_batch_requests_); 194 RunFront(&pending_batch_requests_);
195 195
196 if (!pending_serial_requests_.empty()) 196 if (!pending_serial_requests_.empty())
197 RunFront(&pending_serial_requests_); 197 RunFront(&pending_serial_requests_);
198 } 198 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 current_delete_request_callback_.Run(quota::kQuotaErrorAbort); 237 current_delete_request_callback_.Run(quota::kQuotaErrorAbort);
238 current_delete_request_callback_.Reset(); 238 current_delete_request_callback_.Reset();
239 GetServiceDeleteCallback()->Cancel(); 239 GetServiceDeleteCallback()->Cancel();
240 } 240 }
241 241
242 if (quota_manager_is_destroyed_) 242 if (quota_manager_is_destroyed_)
243 delete this; 243 delete this;
244 } 244 }
245 245
246 } // namespace appcache 246 } // namespace appcache
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_quota_client_unittest.cc ('k') | webkit/appcache/appcache_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698