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

Unified Diff: net/disk_cache/simple/simple_backend_impl.h

Issue 13839011: Asynchronous initialization in Simple Index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_backend_impl.h
diff --git a/net/disk_cache/simple/simple_backend_impl.h b/net/disk_cache/simple/simple_backend_impl.h
index 0c7ba8cf8cb762991f178e97eb60bf0fcbf78dfd..fd5c53a936cc938754acd42c74edd08487ec1c1b 100644
--- a/net/disk_cache/simple/simple_backend_impl.h
+++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -15,6 +15,10 @@
#include "net/base/cache_type.h"
#include "net/disk_cache/disk_cache.h"
+namespace base {
+class MessageLoopProxy;
+}
+
namespace disk_cache {
// SimpleBackendImpl is a new cache backend that stores entries in individual
@@ -34,10 +38,11 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend {
const scoped_refptr<base::TaskRunner>& cache_thread,
net::NetLog* net_log);
- int Init(const CompletionCallback& callback);
-
virtual ~SimpleBackendImpl();
+ // Must run on IO Thread.
+ int Init(const CompletionCallback& completion_callback);
+
// From Backend:
virtual net::CacheType GetCacheType() const OVERRIDE;
virtual int32 GetEntryCount() const OVERRIDE;
@@ -61,12 +66,19 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend {
virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
private:
+ typedef base::Callback<void(int result)> InitializeIndexCallback;
+
+ // Must run on IO Thread.
+ void InitializeIndex(const CompletionCallback& callback, int result);
+
+ // Try to create the directory if it doesn't exist.
// Must run on Cache Thread.
- void InitializeIndex(base::MessageLoopProxy* io_thread,
- const CompletionCallback& callback);
+ static void CreateDirectory(
+ base::MessageLoopProxy* io_thread,
+ const base::FilePath& path,
+ const InitializeIndexCallback& initialize_index_callback);
const base::FilePath path_;
-
scoped_ptr<SimpleIndex> index_;
const scoped_refptr<base::TaskRunner> cache_thread_;
};
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698