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

Unified Diff: net/disk_cache/cache_util.h

Issue 12794003: Initialize the simple cache backend at runtime. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased to latest, auto-merged net.gyp Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/cache_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/cache_util.h
diff --git a/net/disk_cache/cache_util.h b/net/disk_cache/cache_util.h
index 0b3ee6e0255f444a716f46410d1c32a3b0af7759..d5cbe1aa647668743384b8069cb340cfb00cb575 100644
--- a/net/disk_cache/cache_util.h
+++ b/net/disk_cache/cache_util.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "net/base/net_export.h"
+#include "net/disk_cache/disk_cache.h"
namespace base {
class FilePath;
@@ -31,6 +32,46 @@ NET_EXPORT_PRIVATE void DeleteCache(const base::FilePath& path,
// Deletes a cache file.
NET_EXPORT_PRIVATE bool DeleteCacheFile(const base::FilePath& name);
+// Renames cache directory synchronously and fires off a background cleanup
+// task. Used by cache creator itself or by backends for self-restart on error.
+bool DelayedCacheCleanup(const base::FilePath& full_path);
+
+// Builds an instance of the backend depending on platform, type, experiments
+// etc. Takes care of the retry state. This object will self-destroy when
+// finished.
+class NET_EXPORT_PRIVATE CacheCreator {
+ public:
+ CacheCreator(const base::FilePath& path, bool force, int max_bytes,
+ net::CacheType type, uint32 flags,
+ base::MessageLoopProxy* thread, net::NetLog* net_log,
+ disk_cache::Backend** backend,
+ const net::CompletionCallback& callback);
+
+ // Creates the backend.
+ int Run();
+
+ private:
+ ~CacheCreator();
+
+ void DoCallback(int result);
+
+ void OnIOComplete(int result);
+
+ const base::FilePath& path_;
+ bool force_;
+ bool retry_;
+ int max_bytes_;
+ net::CacheType type_;
+ uint32 flags_;
+ scoped_refptr<base::MessageLoopProxy> thread_;
+ disk_cache::Backend** backend_;
+ net::CompletionCallback callback_;
+ disk_cache::Backend* created_cache_;
+ net::NetLog* net_log_;
+
+ DISALLOW_COPY_AND_ASSIGN(CacheCreator);
+};
+
} // namespace disk_cache
#endif // NET_DISK_CACHE_CACHE_UTIL_H_
« no previous file with comments | « net/disk_cache/cache_creator.cc ('k') | net/disk_cache/cache_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698