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

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: 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
Index: net/disk_cache/cache_util.h
===================================================================
--- net/disk_cache/cache_util.h (revision 190930)
+++ net/disk_cache/cache_util.h (working copy)
@@ -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 @@
// 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.
+NET_EXPORT_PRIVATE bool DelayedCacheCleanup(const base::FilePath& full_path);
rvargas (doing something else) 2013/03/28 03:12:45 why export this?. I don't think we should (unless
pasko-google - do not use 2013/03/28 21:41:42 I am confused. NET_EXPORT and NET_EXPORT_PRIVATE h
rvargas (doing something else) 2013/03/28 22:30:21 They are always the same thing... the idea is that
pasko-google - do not use 2013/03/29 02:20:26 OK, you eliminated my confusion, and I might only
rvargas (doing something else) 2013/03/29 06:49:22 We have more bots building the component build tha
+
+// Builds an instance of the backend depending on command-line option(s),
rvargas (doing something else) 2013/03/28 03:12:45 Don't mention command line options. The _implement
pasko-google - do not use 2013/03/28 21:41:42 Replaced commandline with experiment in the descri
rvargas (doing something else) 2013/03/28 22:30:21 but headers are meant to document interfaces and a
pasko-google - do not use 2013/03/29 02:20:26 Ah, I see. The comment was intended to suggest a c
+// platform, type, etc. Takes care of the retry state. This object will
+// self-destroy when finished.
+class NET_EXPORT_PRIVATE CacheCreator {
rvargas (doing something else) 2013/03/28 03:12:45 As I said somewhere else, I think we should be tes
pasko-google - do not use 2013/03/28 21:41:42 I will try to ignore all the flags on the few forc
+ 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_

Powered by Google App Engine
This is Rietveld 408576698