OLD | NEW |
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/browser/appcache/appcache_quota_client.h" | 5 #include "content/browser/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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "webkit/browser/appcache/appcache_service_impl.h" | 13 #include "content/browser/appcache/appcache_service_impl.h" |
14 | 14 |
15 using quota::QuotaClient; | 15 using quota::QuotaClient; |
16 | 16 |
17 namespace { | 17 namespace { |
18 quota::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) { | 18 quota::QuotaStatusCode NetErrorCodeToQuotaStatus(int code) { |
19 if (code == net::OK) | 19 if (code == net::OK) |
20 return quota::kQuotaStatusOk; | 20 return quota::kQuotaStatusOk; |
21 else if (code == net::ERR_ABORTED) | 21 else if (code == net::ERR_ABORTED) |
22 return quota::kQuotaErrorAbort; | 22 return quota::kQuotaErrorAbort; |
23 else | 23 else |
24 return quota::kQuotaStatusUnknown; | 24 return quota::kQuotaStatusUnknown; |
25 } | 25 } |
26 | 26 |
27 void RunFront(appcache::AppCacheQuotaClient::RequestQueue* queue) { | 27 void RunFront(content::AppCacheQuotaClient::RequestQueue* queue) { |
28 base::Closure request = queue->front(); | 28 base::Closure request = queue->front(); |
29 queue->pop_front(); | 29 queue->pop_front(); |
30 request.Run(); | 30 request.Run(); |
31 } | 31 } |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 namespace appcache { | 34 namespace content { |
35 | 35 |
36 AppCacheQuotaClient::AppCacheQuotaClient(AppCacheServiceImpl* service) | 36 AppCacheQuotaClient::AppCacheQuotaClient(AppCacheServiceImpl* service) |
37 : service_(service), | 37 : service_(service), |
38 appcache_is_ready_(false), | 38 appcache_is_ready_(false), |
39 quota_manager_is_destroyed_(false) { | 39 quota_manager_is_destroyed_(false) { |
40 } | 40 } |
41 | 41 |
42 AppCacheQuotaClient::~AppCacheQuotaClient() { | 42 AppCacheQuotaClient::~AppCacheQuotaClient() { |
43 DCHECK(pending_batch_requests_.empty()); | 43 DCHECK(pending_batch_requests_.empty()); |
44 DCHECK(pending_serial_requests_.empty()); | 44 DCHECK(pending_serial_requests_.empty()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (!current_delete_request_callback_.is_null()) { | 243 if (!current_delete_request_callback_.is_null()) { |
244 current_delete_request_callback_.Run(quota::kQuotaErrorAbort); | 244 current_delete_request_callback_.Run(quota::kQuotaErrorAbort); |
245 current_delete_request_callback_.Reset(); | 245 current_delete_request_callback_.Reset(); |
246 GetServiceDeleteCallback()->Cancel(); | 246 GetServiceDeleteCallback()->Cancel(); |
247 } | 247 } |
248 | 248 |
249 if (quota_manager_is_destroyed_) | 249 if (quota_manager_is_destroyed_) |
250 delete this; | 250 delete this; |
251 } | 251 } |
252 | 252 |
253 } // namespace appcache | 253 } // namespace content |
OLD | NEW |