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 "content/browser/indexed_db/indexed_db_quota_client.h" | 5 #include "content/browser/indexed_db/indexed_db_quota_client.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <vector> | 9 #include <vector> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 12 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
13 #include "storage/browser/database/database_util.h" | 15 #include "storage/browser/database/database_util.h" |
14 | 16 |
15 using storage::QuotaClient; | 17 using storage::QuotaClient; |
16 using storage::DatabaseUtil; | 18 using storage::DatabaseUtil; |
17 | 19 |
18 namespace content { | 20 namespace content { |
19 namespace { | 21 namespace { |
20 | 22 |
21 storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( | 23 storage::QuotaStatusCode DeleteOriginDataOnIndexedDBThread( |
22 IndexedDBContextImpl* context, | 24 IndexedDBContextImpl* context, |
23 const GURL& origin) { | 25 const GURL& origin) { |
24 context->DeleteForOrigin(origin); | 26 context->DeleteForOrigin(origin); |
25 return storage::kQuotaStatusOk; | 27 return storage::kQuotaStatusOk; |
26 } | 28 } |
27 | 29 |
28 int64 GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, | 30 int64_t GetOriginUsageOnIndexedDBThread(IndexedDBContextImpl* context, |
29 const GURL& origin) { | 31 const GURL& origin) { |
30 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 32 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
31 return context->GetOriginDiskUsage(origin); | 33 return context->GetOriginDiskUsage(origin); |
32 } | 34 } |
33 | 35 |
34 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, | 36 void GetAllOriginsOnIndexedDBThread(IndexedDBContextImpl* context, |
35 std::set<GURL>* origins_to_return) { | 37 std::set<GURL>* origins_to_return) { |
36 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); | 38 DCHECK(context->TaskRunner()->RunsTasksOnCurrentThread()); |
37 std::vector<GURL> all_origins = context->GetAllOrigins(); | 39 std::vector<GURL> all_origins = context->GetAllOrigins(); |
38 origins_to_return->insert(all_origins.begin(), all_origins.end()); | 40 origins_to_return->insert(all_origins.begin(), all_origins.end()); |
39 } | 41 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 base::Bind( | 173 base::Bind( |
172 &DeleteOriginDataOnIndexedDBThread, indexed_db_context_, origin), | 174 &DeleteOriginDataOnIndexedDBThread, indexed_db_context_, origin), |
173 callback); | 175 callback); |
174 } | 176 } |
175 | 177 |
176 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { | 178 bool IndexedDBQuotaClient::DoesSupport(storage::StorageType type) const { |
177 return type == storage::kStorageTypeTemporary; | 179 return type == storage::kStorageTypeTemporary; |
178 } | 180 } |
179 | 181 |
180 } // namespace content | 182 } // namespace content |
OLD | NEW |