OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/simple/simple_index_file.h" | 5 #include "net/disk_cache/simple/simple_index_file.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 23 matching lines...) Expand all Loading... |
34 PLOG(ERROR) << "opendir " << cache_path.value(); | 34 PLOG(ERROR) << "opendir " << cache_path.value(); |
35 return false; | 35 return false; |
36 } | 36 } |
37 dirent entry, *result; | 37 dirent entry, *result; |
38 while (readdir_r(dir.get(), &entry, &result) == 0) { | 38 while (readdir_r(dir.get(), &entry, &result) == 0) { |
39 if (!result) | 39 if (!result) |
40 return true; // The traversal completed successfully. | 40 return true; // The traversal completed successfully. |
41 const std::string file_name(result->d_name); | 41 const std::string file_name(result->d_name); |
42 if (file_name == "." || file_name == "..") | 42 if (file_name == "." || file_name == "..") |
43 continue; | 43 continue; |
44 const base::FilePath file_path = cache_path.Append( | 44 const base::FilePath file_path = |
45 base::FilePath(file_name)); | 45 cache_path.Append(base::FilePath(file_name)); |
46 entry_file_callback.Run(file_path); | 46 entry_file_callback.Run(file_path); |
47 } | 47 } |
48 PLOG(ERROR) << "readdir_r " << cache_path.value(); | 48 PLOG(ERROR) << "readdir_r " << cache_path.value(); |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
52 } // namespace disk_cache | 52 } // namespace disk_cache |
OLD | NEW |