OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // See net/disk_cache/disk_cache.h for the public interface of the cache. | |
6 | |
7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_ | |
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_ | |
9 | |
10 #include "base/containers/hash_tables.h" | |
11 #include "base/files/file_path.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "net/disk_cache/blockfile/addr.h" | |
15 #include "net/disk_cache/blockfile/backend_impl_v3.h" | |
16 #include "net/disk_cache/blockfile/block_files.h" | |
17 | |
18 namespace base { | |
19 class SingleThreadTaskRunner; | |
20 } // namespace base | |
21 | |
22 namespace disk_cache { | |
23 | |
24 class BackendImplV3::Worker : public base::RefCountedThreadSafe<Worker> { | |
25 public: | |
26 Worker(const base::FilePath& path, | |
27 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread); | |
28 | |
29 // Performs general initialization for this current instance of the cache. | |
30 int Init(const CompletionCallback& callback); | |
31 | |
32 private: | |
33 friend class base::RefCountedThreadSafe<Worker>; | |
34 | |
35 ~Worker(); | |
36 void CleanupCache(); | |
37 | |
38 // Returns the full name for an external storage file. | |
39 base::FilePath GetFileName(Addr address) const; | |
40 | |
41 // Creates a new backing file for the cache index. | |
42 bool CreateBackingStore(disk_cache::File* file); | |
43 bool InitBackingStore(bool* file_created); | |
44 | |
45 // Performs basic checks on the index file. Returns false on failure. | |
46 bool CheckIndex(); | |
47 | |
48 base::FilePath path_; // Path to the folder used as backing storage. | |
49 BlockFiles block_files_; // Set of files used to store all data. | |
50 bool init_; // controls the initialization of the system. | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(Worker); | |
53 }; | |
54 | |
55 } // namespace disk_cache | |
56 | |
57 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_ | |
OLD | NEW |