Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / net / disk_cache / simple / simple_version_upgrade.h
blob352379b997b468e23fe01788f4e5892c8d97561b
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_VERSION_UPGRADE_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_VERSION_UPGRADE_H_
8 // Defines functionality to upgrade the file structure of the Simple Cache
9 // Backend on disk. Assumes no backend operations are running simultaneously.
10 // Hence must be run at cache initialization step.
12 #include "base/basictypes.h"
13 #include "net/base/net_export.h"
15 namespace base {
16 class FilePath;
19 namespace disk_cache {
21 // Performs all necessary disk IO to upgrade the cache structure if it is
22 // needed.
24 // Returns true iff no errors were found during consistency checks and all
25 // necessary transitions succeeded. If this function fails, there is nothing
26 // left to do other than dropping the whole cache directory.
27 NET_EXPORT_PRIVATE bool UpgradeSimpleCacheOnDisk(const base::FilePath& path);
29 // The format for the fake index has mistakenly acquired two extra fields that
30 // do not contain any useful data. Since they were equal to zero, they are now
31 // mandatated to be zero.
32 struct NET_EXPORT_PRIVATE FakeIndexData {
33 FakeIndexData();
35 // Must be equal to simplecache_v4::kSimpleInitialMagicNumber.
36 uint64 initial_magic_number;
38 // Must be equal kSimpleVersion when the cache backend is instantiated.
39 uint32 version;
41 uint32 unused_must_be_zero1;
42 uint32 unused_must_be_zero2;
45 // Exposed for testing.
46 NET_EXPORT_PRIVATE bool UpgradeIndexV5V6(const base::FilePath& cache_directory);
48 } // namespace disk_cache
50 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_VERSION_UPGRADE_H_