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.
5 // See net/disk_cache/disk_cache.h for the public interface of the cache.
7 #ifndef NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_
8 #define NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_
10 #include "base/containers/hash_tables.h"
11 #include "base/files/file_path.h"
12 #include "net/disk_cache/blockfile/addr.h"
13 #include "net/disk_cache/blockfile/backend_impl_v3.h"
14 #include "net/disk_cache/blockfile/block_files.h"
16 namespace disk_cache
{
18 class BackendImplV3::Worker
: public base::RefCountedThreadSafe
<Worker
> {
20 Worker(const base::FilePath
& path
, base::MessageLoopProxy
* main_thread
);
22 // Performs general initialization for this current instance of the cache.
23 int Init(const CompletionCallback
& callback
);
26 friend class base::RefCountedThreadSafe
<Worker
>;
31 // Returns the full name for an external storage file.
32 base::FilePath
GetFileName(Addr address
) const;
34 // Creates a new backing file for the cache index.
35 bool CreateBackingStore(disk_cache::File
* file
);
36 bool InitBackingStore(bool* file_created
);
38 // Performs basic checks on the index file. Returns false on failure.
41 base::FilePath path_
; // Path to the folder used as backing storage.
42 BlockFiles block_files_
; // Set of files used to store all data.
43 bool init_
; // controls the initialization of the system.
45 DISALLOW_COPY_AND_ASSIGN(Worker
);
48 } // namespace disk_cache
50 #endif // NET_DISK_CACHE_BLOCKFILE_BACKEND_WORKER_V3_H_