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_context_impl.h" | 5 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 database_list->Append(db_info.release()); | 266 database_list->Append(db_info.release()); |
267 } | 267 } |
268 info->Set("databases", database_list.release()); | 268 info->Set("databases", database_list.release()); |
269 } | 269 } |
270 | 270 |
271 list->Append(info.release()); | 271 list->Append(info.release()); |
272 } | 272 } |
273 return list.release(); | 273 return list.release(); |
274 } | 274 } |
275 | 275 |
| 276 int IndexedDBContextImpl::GetOriginBlobFileCount(const GURL& origin_url) { |
| 277 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
| 278 int count = 0; |
| 279 base::FileEnumerator file_enumerator( |
| 280 GetBlobPath(storage::GetIdentifierFromOrigin(origin_url)), true, |
| 281 base::FileEnumerator::FILES); |
| 282 for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); |
| 283 file_path = file_enumerator.Next()) { |
| 284 count++; |
| 285 } |
| 286 return count; |
| 287 } |
| 288 |
276 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { | 289 int64 IndexedDBContextImpl::GetOriginDiskUsage(const GURL& origin_url) { |
277 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 290 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
278 if (data_path_.empty() || !IsInOriginSet(origin_url)) | 291 if (data_path_.empty() || !IsInOriginSet(origin_url)) |
279 return 0; | 292 return 0; |
280 EnsureDiskUsageCacheInitialized(origin_url); | 293 EnsureDiskUsageCacheInitialized(origin_url); |
281 return origin_size_map_[origin_url]; | 294 return origin_size_map_[origin_url]; |
282 } | 295 } |
283 | 296 |
284 base::Time IndexedDBContextImpl::GetOriginLastModified(const GURL& origin_url) { | 297 base::Time IndexedDBContextImpl::GetOriginLastModified(const GURL& origin_url) { |
285 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 298 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 origin_set_.reset(); | 616 origin_set_.reset(); |
604 origin_size_map_.clear(); | 617 origin_size_map_.clear(); |
605 space_available_map_.clear(); | 618 space_available_map_.clear(); |
606 } | 619 } |
607 | 620 |
608 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { | 621 base::SequencedTaskRunner* IndexedDBContextImpl::TaskRunner() const { |
609 return task_runner_.get(); | 622 return task_runner_.get(); |
610 } | 623 } |
611 | 624 |
612 } // namespace content | 625 } // namespace content |
OLD | NEW |