Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Side by Side Diff: webkit/fileapi/file_system_usage_cache.cc

Issue 9910005: Add database recovery for FileSystemDirectoryDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_usage_cache.h ('k') | webkit/fileapi/file_system_usage_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698