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_backend_impl.h" | 5 #include "net/disk_cache/simple/simple_backend_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 | 9 |
10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 const base::FilePath& path, | 396 const base::FilePath& path, |
397 uint64 suggested_max_size) { | 397 uint64 suggested_max_size) { |
398 DiskStatResult result; | 398 DiskStatResult result; |
399 result.max_size = suggested_max_size; | 399 result.max_size = suggested_max_size; |
400 result.net_error = net::OK; | 400 result.net_error = net::OK; |
401 if (!FileStructureConsistent(path)) { | 401 if (!FileStructureConsistent(path)) { |
402 LOG(ERROR) << "Simple Cache Backend: wrong file structure on disk: " | 402 LOG(ERROR) << "Simple Cache Backend: wrong file structure on disk: " |
403 << path.LossyDisplayName(); | 403 << path.LossyDisplayName(); |
404 result.net_error = net::ERR_FAILED; | 404 result.net_error = net::ERR_FAILED; |
405 } else { | 405 } else { |
406 bool mtime_result = | 406 base::PlatformFileInfo file_info; |
407 disk_cache::simple_util::GetMTime(path, &result.cache_dir_mtime); | 407 bool file_info_result = file_util::GetFileInfo(path, &file_info); |
408 DCHECK(mtime_result); | 408 DCHECK(file_info_result); |
| 409 result.cache_dir_mtime = file_info.last_modified; |
409 if (!result.max_size) { | 410 if (!result.max_size) { |
410 int64 available = base::SysInfo::AmountOfFreeDiskSpace(path); | 411 int64 available = base::SysInfo::AmountOfFreeDiskSpace(path); |
411 if (available < 0) | 412 if (available < 0) |
412 result.max_size = kDefaultCacheSize; | 413 result.max_size = kDefaultCacheSize; |
413 else | 414 else |
414 // TODO(pasko): Move PreferedCacheSize() to cache_util.h. Also fix the | 415 // TODO(pasko): Move PreferedCacheSize() to cache_util.h. Also fix the |
415 // spelling. | 416 // spelling. |
416 result.max_size = disk_cache::PreferedCacheSize(available); | 417 result.max_size = disk_cache::PreferedCacheSize(available); |
417 } | 418 } |
418 DCHECK(result.max_size); | 419 DCHECK(result.max_size); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 const CompletionCallback& callback, | 562 const CompletionCallback& callback, |
562 int error_code) { | 563 int error_code) { |
563 if (error_code == net::ERR_FAILED) { | 564 if (error_code == net::ERR_FAILED) { |
564 OpenNextEntry(iter, entry, callback); | 565 OpenNextEntry(iter, entry, callback); |
565 return; | 566 return; |
566 } | 567 } |
567 CallCompletionCallback(callback, error_code); | 568 CallCompletionCallback(callback, error_code); |
568 } | 569 } |
569 | 570 |
570 } // namespace disk_cache | 571 } // namespace disk_cache |
OLD | NEW |