| 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 "webkit/fileapi/file_system_usage_cache.h" | 5 #include "webkit/fileapi/file_system_usage_cache.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 | 10 |
| 11 namespace fileapi { | 11 namespace fileapi { |
| 12 | 12 |
| 13 const char FileSystemUsageCache::kUsageFileName[] = ".usage"; | 13 const FilePath::CharType FileSystemUsageCache::kUsageFileName[] = |
| 14 FILE_PATH_LITERAL(".usage"); |
| 14 const char FileSystemUsageCache::kUsageFileHeader[] = "FSU4"; | 15 const char FileSystemUsageCache::kUsageFileHeader[] = "FSU4"; |
| 15 const int FileSystemUsageCache::kUsageFileHeaderSize = 4; | 16 const int FileSystemUsageCache::kUsageFileHeaderSize = 4; |
| 16 | 17 |
| 17 /* Pickle::{Read,Write}Bool treat bool as int */ | 18 /* Pickle::{Read,Write}Bool treat bool as int */ |
| 18 const int FileSystemUsageCache::kUsageFileSize = | 19 const int FileSystemUsageCache::kUsageFileSize = |
| 19 sizeof(Pickle::Header) + | 20 sizeof(Pickle::Header) + |
| 20 FileSystemUsageCache::kUsageFileHeaderSize + | 21 FileSystemUsageCache::kUsageFileHeaderSize + |
| 21 sizeof(int) + sizeof(int32) + sizeof(int64); | 22 sizeof(int) + sizeof(int32) + sizeof(int64); |
| 22 | 23 |
| 23 // static | 24 // static |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (bytes_written != kUsageFileSize) | 171 if (bytes_written != kUsageFileSize) |
| 171 return -1; | 172 return -1; |
| 172 | 173 |
| 173 if (file_util::ReplaceFile(temporary_usage_file_path, usage_file_path)) | 174 if (file_util::ReplaceFile(temporary_usage_file_path, usage_file_path)) |
| 174 return bytes_written; | 175 return bytes_written; |
| 175 else | 176 else |
| 176 return -1; | 177 return -1; |
| 177 } | 178 } |
| 178 | 179 |
| 179 } // namespace fileapi | 180 } // namespace fileapi |
| OLD | NEW |