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

Unified Diff: net/disk_cache/very_simple/very_simple_backend_impl.h

Issue 12192005: Add new simple disk cache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to trunk (::FilePath --> base::FilePath) Created 7 years, 11 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/very_simple/very_simple_backend_impl.h
diff --git a/net/disk_cache/very_simple/very_simple_backend_impl.h b/net/disk_cache/very_simple/very_simple_backend_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f5a193fdc9ad9303635babdc5f3dd19fba4bc369
--- /dev/null
+++ b/net/disk_cache/very_simple/very_simple_backend_impl.h
@@ -0,0 +1,72 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_
+#define NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/file_path.h"
+#include "base/threading/thread_checker.h"
+#include "net/disk_cache/disk_cache.h"
+#include "net/http/http_cache.h"
rvargas (doing something else) 2013/02/06 03:28:40 logical layering violation
gavinp 2013/02/08 23:17:51 Done. Can you please tell us more about what HttpC
rvargas (doing something else) 2013/02/13 01:48:46 It is intended for simplifying creation of the Htt
+
+namespace disk_cache {
+
+class VerySimpleBackendImpl : public Backend {
rvargas (doing something else) 2013/02/06 03:28:40 Description of this class would be good... a file
gavinp 2013/02/08 23:17:51 Done.
+ public:
+ class BackendFactory : public net::HttpCache::BackendFactory {
rvargas (doing something else) 2013/02/06 03:28:40 This should not be an HttpCache::BackednFactory
gavinp 2013/02/08 23:17:51 Done.
+ public:
+ explicit BackendFactory(const FilePath& path);
+ virtual ~BackendFactory();
+
+ virtual int CreateBackend(net::NetLog* net_log,
+ disk_cache::Backend** backend,
+ const CompletionCallback& callback) OVERRIDE;
+
+ private:
+ const FilePath path_;
+ };
+
+ virtual ~VerySimpleBackendImpl();
+
+ // From Backend:
+ virtual net::CacheType GetCacheType() const OVERRIDE;
+ virtual int32 GetEntryCount() const OVERRIDE;
+ virtual int OpenEntry(const std::string& key, Entry** entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int CreateEntry(const std::string& key, Entry** entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntry(const std::string& key,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntriesBetween(base::Time initial_time,
+ base::Time end_time,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int DoomEntriesSince(base::Time initial_time,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ const CompletionCallback& callback) OVERRIDE;
+ virtual void EndEnumeration(void** iter) OVERRIDE;
+ virtual void GetStats(
+ std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE;
+ virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
+
+ private:
+ friend class BackendFactory;
+
+ explicit VerySimpleBackendImpl(const FilePath& path);
+
+ static VerySimpleBackendImpl* Create(const FilePath& path);
rvargas (doing something else) 2013/02/06 03:28:40 Given that there is a factory method why do we nee
gavinp 2013/02/08 23:17:51 See my comments to Egor. I was being silly in keep
+
+ base::ThreadChecker thread_checker_;
+ const FilePath path_;
+};
+
+} // namespace disk_cache
+
+#endif // NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698