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

Side by Side Diff: net/disk_cache/cache_util.h

Issue 13517004: Test cache creation retry via public interface only. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: check cache integrity after destroying the backend Created 7 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
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_DISK_CACHE_CACHE_UTIL_H_ 5 #ifndef NET_DISK_CACHE_CACHE_UTIL_H_
6 #define NET_DISK_CACHE_CACHE_UTIL_H_ 6 #define NET_DISK_CACHE_CACHE_UTIL_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "net/base/net_export.h" 9 #include "net/base/net_export.h"
10 #include "net/disk_cache/disk_cache.h" 10 #include "net/disk_cache/disk_cache.h"
(...skipping 18 matching lines...) Expand all
29 NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path, 29 NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path,
30 bool remove_folder); 30 bool remove_folder);
31 31
32 // Deletes a cache file. 32 // Deletes a cache file.
33 NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name); 33 NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name);
34 34
35 // Renames cache directory synchronously and fires off a background cleanup 35 // Renames cache directory synchronously and fires off a background cleanup
36 // task. Used by cache creator itself or by backends for self-restart on error. 36 // task. Used by cache creator itself or by backends for self-restart on error.
37 bool DelayedCacheCleanup(const base::FilePath& full_path); 37 bool DelayedCacheCleanup(const base::FilePath& full_path);
38 38
39 // Builds an instance of the backend depending on platform, type, experiments
40 // etc. Takes care of the retry state. This object will self-destroy when
41 // finished.
42 class NET_EXPORT_PRIVATE CacheCreator {
43 public:
44 CacheCreator(const base::FilePath& path, bool force, int max_bytes,
45 net::CacheType type, uint32 flags,
46 base::MessageLoopProxy* thread, net::NetLog* net_log,
47 disk_cache::Backend** backend,
48 const net::CompletionCallback& callback);
49
50 // Creates the backend.
51 int Run();
52
53 private:
54 ~CacheCreator();
55
56 void DoCallback(int result);
57
58 void OnIOComplete(int result);
59
60 const base::FilePath& path_;
61 bool force_;
62 bool retry_;
63 int max_bytes_;
64 net::CacheType type_;
65 uint32 flags_;
66 scoped_refptr<base::MessageLoopProxy> thread_;
67 disk_cache::Backend** backend_;
68 net::CompletionCallback callback_;
69 disk_cache::Backend* created_cache_;
70 net::NetLog* net_log_;
71 bool use_simple_cache_backend_;
72
73 DISALLOW_COPY_AND_ASSIGN(CacheCreator);
74 };
75
76 } // namespace disk_cache 39 } // namespace disk_cache
77 40
78 #endif // NET_DISK_CACHE_CACHE_UTIL_H_ 41 #endif // NET_DISK_CACHE_CACHE_UTIL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/disk_cache_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698