| 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_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 | 1240 |
| 1241 header.create_time = Time::Now().ToInternalValue(); | 1241 header.create_time = Time::Now().ToInternalValue(); |
| 1242 | 1242 |
| 1243 if (!file->Write(&header, sizeof(header), 0)) | 1243 if (!file->Write(&header, sizeof(header), 0)) |
| 1244 return false; | 1244 return false; |
| 1245 | 1245 |
| 1246 return file->SetLength(GetIndexSize(header.table_len)); | 1246 return file->SetLength(GetIndexSize(header.table_len)); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 bool BackendImpl::InitBackingStore(bool* file_created) { | 1249 bool BackendImpl::InitBackingStore(bool* file_created) { |
| 1250 if (!file_util::CreateDirectory(path_)) | 1250 if (!base::CreateDirectory(path_)) |
| 1251 return false; | 1251 return false; |
| 1252 | 1252 |
| 1253 base::FilePath index_name = path_.AppendASCII(kIndexName); | 1253 base::FilePath index_name = path_.AppendASCII(kIndexName); |
| 1254 | 1254 |
| 1255 int flags = base::PLATFORM_FILE_READ | | 1255 int flags = base::PLATFORM_FILE_READ | |
| 1256 base::PLATFORM_FILE_WRITE | | 1256 base::PLATFORM_FILE_WRITE | |
| 1257 base::PLATFORM_FILE_OPEN_ALWAYS | | 1257 base::PLATFORM_FILE_OPEN_ALWAYS | |
| 1258 base::PLATFORM_FILE_EXCLUSIVE_WRITE; | 1258 base::PLATFORM_FILE_EXCLUSIVE_WRITE; |
| 1259 scoped_refptr<disk_cache::File> file(new disk_cache::File( | 1259 scoped_refptr<disk_cache::File> file(new disk_cache::File( |
| 1260 base::CreatePlatformFile(index_name, flags, file_created, NULL))); | 1260 base::CreatePlatformFile(index_name, flags, file_created, NULL))); |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2077 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2078 total_memory = kMaxBuffersSize; | 2078 total_memory = kMaxBuffersSize; |
| 2079 | 2079 |
| 2080 done = true; | 2080 done = true; |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 return static_cast<int>(total_memory); | 2083 return static_cast<int>(total_memory); |
| 2084 } | 2084 } |
| 2085 | 2085 |
| 2086 } // namespace disk_cache | 2086 } // namespace disk_cache |
| OLD | NEW |