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

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') | net/disk_cache/simple/simple_index.cc » ('J')
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..5e4895ea048f09382cf48f06b0c94dd0310a7874 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,7 +38,8 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend {
const scoped_refptr<base::TaskRunner>& cache_thread,
net::NetLog* net_log);
- int Init(const CompletionCallback& callback);
+ // Must run on IO Thread.
+ int Init(const CompletionCallback& completion_callback);
virtual ~SimpleBackendImpl();
gavinp 2013/04/11 11:59:26 Method ordering: Constructor, Destructor, then oth
felipeg 2013/04/11 12:12:54 Done.
@@ -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') | net/disk_cache/simple/simple_index.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698