| 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 "net/disk_cache/cache_util.h" | 5 #include "net/disk_cache/cache_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Returns a full path to rename the current cache, in order to delete it. path | 37 // Returns a full path to rename the current cache, in order to delete it. path |
| 38 // is the current folder location, and name is the current folder name. | 38 // is the current folder location, and name is the current folder name. |
| 39 base::FilePath GetTempCacheName(const base::FilePath& path, | 39 base::FilePath GetTempCacheName(const base::FilePath& path, |
| 40 const std::string& name) { | 40 const std::string& name) { |
| 41 // We'll attempt to have up to kMaxOldFolders folders for deletion. | 41 // We'll attempt to have up to kMaxOldFolders folders for deletion. |
| 42 for (int i = 0; i < kMaxOldFolders; i++) { | 42 for (int i = 0; i < kMaxOldFolders; i++) { |
| 43 base::FilePath to_delete = GetPrefixedName(path, name, i); | 43 base::FilePath to_delete = GetPrefixedName(path, name, i); |
| 44 if (!file_util::PathExists(to_delete)) | 44 if (!base::PathExists(to_delete)) |
| 45 return to_delete; | 45 return to_delete; |
| 46 } | 46 } |
| 47 return base::FilePath(); | 47 return base::FilePath(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 namespace disk_cache { | 52 namespace disk_cache { |
| 53 | 53 |
| 54 // In order to process a potentially large number of files, we'll rename the | 54 // In order to process a potentially large number of files, we'll rename the |
| (...skipping 29 matching lines...) Expand all Loading... |
| 84 << to_delete.value(); | 84 << to_delete.value(); |
| 85 return false; | 85 return false; |
| 86 } | 86 } |
| 87 | 87 |
| 88 base::WorkerPool::PostTask( | 88 base::WorkerPool::PostTask( |
| 89 FROM_HERE, base::Bind(&CleanupCallback, path, name_str), true); | 89 FROM_HERE, base::Bind(&CleanupCallback, path, name_str), true); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace disk_cache | 93 } // namespace disk_cache |
| OLD | NEW |