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/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 } | 853 } |
854 FilePath name = GetFileName(file_address); | 854 FilePath name = GetFileName(file_address); |
855 int flags = base::PLATFORM_FILE_READ | | 855 int flags = base::PLATFORM_FILE_READ | |
856 base::PLATFORM_FILE_WRITE | | 856 base::PLATFORM_FILE_WRITE | |
857 base::PLATFORM_FILE_CREATE | | 857 base::PLATFORM_FILE_CREATE | |
858 base::PLATFORM_FILE_EXCLUSIVE_WRITE; | 858 base::PLATFORM_FILE_EXCLUSIVE_WRITE; |
859 base::PlatformFileError error; | 859 base::PlatformFileError error; |
860 scoped_refptr<disk_cache::File> file(new disk_cache::File( | 860 scoped_refptr<disk_cache::File> file(new disk_cache::File( |
861 base::CreatePlatformFile(name, flags, NULL, &error))); | 861 base::CreatePlatformFile(name, flags, NULL, &error))); |
862 if (!file->IsValid()) { | 862 if (!file->IsValid()) { |
863 if (error != base::PLATFORM_FILE_ERROR_EXISTS) | 863 if (error != base::PLATFORM_FILE_ERROR_EXISTS) { |
| 864 LOG(ERROR) << "Unable to create file: " << error; |
864 return false; | 865 return false; |
| 866 } |
865 continue; | 867 continue; |
866 } | 868 } |
867 | 869 |
868 success = true; | 870 success = true; |
869 break; | 871 break; |
870 } | 872 } |
871 | 873 |
872 DCHECK(success); | 874 DCHECK(success); |
873 if (!success) | 875 if (!success) |
874 return false; | 876 return false; |
(...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2172 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2171 total_memory = kMaxBuffersSize; | 2173 total_memory = kMaxBuffersSize; |
2172 | 2174 |
2173 done = true; | 2175 done = true; |
2174 } | 2176 } |
2175 | 2177 |
2176 return static_cast<int>(total_memory); | 2178 return static_cast<int>(total_memory); |
2177 } | 2179 } |
2178 | 2180 |
2179 } // namespace disk_cache | 2181 } // namespace disk_cache |
OLD | NEW |