| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DCHECK_EQ(origins.size(), file_paths.size()); | 74 DCHECK_EQ(origins.size(), file_paths.size()); |
| 75 std::vector<base::FilePath>::const_iterator file_path_iter = | 75 std::vector<base::FilePath>::const_iterator file_path_iter = |
| 76 file_paths.begin(); | 76 file_paths.begin(); |
| 77 for (std::vector<GURL>::const_iterator iter = origins.begin(); | 77 for (std::vector<GURL>::const_iterator iter = origins.begin(); |
| 78 iter != origins.end(); | 78 iter != origins.end(); |
| 79 ++iter, ++file_path_iter) { | 79 ++iter, ++file_path_iter) { |
| 80 if (!special_storage_policy->IsStorageSessionOnly(*iter)) | 80 if (!special_storage_policy->IsStorageSessionOnly(*iter)) |
| 81 continue; | 81 continue; |
| 82 if (special_storage_policy->IsStorageProtected(*iter)) | 82 if (special_storage_policy->IsStorageProtected(*iter)) |
| 83 continue; | 83 continue; |
| 84 base::Delete(*file_path_iter, true); | 84 base::DeleteFile(*file_path_iter, true); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 IndexedDBContextImpl::IndexedDBContextImpl( | 90 IndexedDBContextImpl::IndexedDBContextImpl( |
| 91 const base::FilePath& data_path, | 91 const base::FilePath& data_path, |
| 92 quota::SpecialStoragePolicy* special_storage_policy, | 92 quota::SpecialStoragePolicy* special_storage_policy, |
| 93 quota::QuotaManagerProxy* quota_manager_proxy, | 93 quota::QuotaManagerProxy* quota_manager_proxy, |
| 94 base::SequencedTaskRunner* task_runner) | 94 base::SequencedTaskRunner* task_runner) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) { | 167 void IndexedDBContextImpl::DeleteForOrigin(const GURL& origin_url) { |
| 168 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); | 168 DCHECK(TaskRunner()->RunsTasksOnCurrentThread()); |
| 169 ForceClose(origin_url); | 169 ForceClose(origin_url); |
| 170 if (data_path_.empty() || !IsInOriginSet(origin_url)) | 170 if (data_path_.empty() || !IsInOriginSet(origin_url)) |
| 171 return; | 171 return; |
| 172 | 172 |
| 173 base::FilePath idb_directory = GetFilePath(origin_url); | 173 base::FilePath idb_directory = GetFilePath(origin_url); |
| 174 EnsureDiskUsageCacheInitialized(origin_url); | 174 EnsureDiskUsageCacheInitialized(origin_url); |
| 175 const bool recursive = true; | 175 const bool recursive = true; |
| 176 bool deleted = base::Delete(idb_directory, recursive); | 176 bool deleted = base::DeleteFile(idb_directory, recursive); |
| 177 | 177 |
| 178 QueryDiskAndUpdateQuotaUsage(origin_url); | 178 QueryDiskAndUpdateQuotaUsage(origin_url); |
| 179 if (deleted) { | 179 if (deleted) { |
| 180 RemoveFromOriginSet(origin_url); | 180 RemoveFromOriginSet(origin_url); |
| 181 origin_size_map_.erase(origin_url); | 181 origin_size_map_.erase(origin_url); |
| 182 space_available_map_.erase(origin_url); | 182 space_available_map_.erase(origin_url); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void IndexedDBContextImpl::ForceClose(const GURL& origin_url) { | 186 void IndexedDBContextImpl::ForceClose(const GURL& origin_url) { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 origin_set_.reset(); | 418 origin_set_.reset(); |
| 419 origin_size_map_.clear(); | 419 origin_size_map_.clear(); |
| 420 space_available_map_.clear(); | 420 space_available_map_.clear(); |
| 421 } | 421 } |
| 422 | 422 |
| 423 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const { | 423 base::TaskRunner* IndexedDBContextImpl::TaskRunner() const { |
| 424 return task_runner_; | 424 return task_runner_; |
| 425 } | 425 } |
| 426 | 426 |
| 427 } // namespace content | 427 } // namespace content |
| OLD | NEW |