Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_ | |
| 6 #define NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <utility> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "base/file_path.h" | |
| 14 #include "base/threading/thread_checker.h" | |
| 15 #include "net/disk_cache/disk_cache.h" | |
| 16 #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
| |
| 17 | |
| 18 namespace disk_cache { | |
| 19 | |
| 20 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.
| |
| 21 public: | |
| 22 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.
| |
| 23 public: | |
| 24 explicit BackendFactory(const FilePath& path); | |
| 25 virtual ~BackendFactory(); | |
| 26 | |
| 27 virtual int CreateBackend(net::NetLog* net_log, | |
| 28 disk_cache::Backend** backend, | |
| 29 const CompletionCallback& callback) OVERRIDE; | |
| 30 | |
| 31 private: | |
| 32 const FilePath path_; | |
| 33 }; | |
| 34 | |
| 35 virtual ~VerySimpleBackendImpl(); | |
| 36 | |
| 37 // From Backend: | |
| 38 virtual net::CacheType GetCacheType() const OVERRIDE; | |
| 39 virtual int32 GetEntryCount() const OVERRIDE; | |
| 40 virtual int OpenEntry(const std::string& key, Entry** entry, | |
| 41 const CompletionCallback& callback) OVERRIDE; | |
| 42 virtual int CreateEntry(const std::string& key, Entry** entry, | |
| 43 const CompletionCallback& callback) OVERRIDE; | |
| 44 virtual int DoomEntry(const std::string& key, | |
| 45 const CompletionCallback& callback) OVERRIDE; | |
| 46 virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; | |
| 47 virtual int DoomEntriesBetween(base::Time initial_time, | |
| 48 base::Time end_time, | |
| 49 const CompletionCallback& callback) OVERRIDE; | |
| 50 virtual int DoomEntriesSince(base::Time initial_time, | |
| 51 const CompletionCallback& callback) OVERRIDE; | |
| 52 virtual int OpenNextEntry(void** iter, Entry** next_entry, | |
| 53 const CompletionCallback& callback) OVERRIDE; | |
| 54 virtual void EndEnumeration(void** iter) OVERRIDE; | |
| 55 virtual void GetStats( | |
| 56 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; | |
| 57 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | |
| 58 | |
| 59 private: | |
| 60 friend class BackendFactory; | |
| 61 | |
| 62 explicit VerySimpleBackendImpl(const FilePath& path); | |
| 63 | |
| 64 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
| |
| 65 | |
| 66 base::ThreadChecker thread_checker_; | |
| 67 const FilePath path_; | |
| 68 }; | |
| 69 | |
| 70 } // namespace disk_cache | |
| 71 | |
| 72 #endif // NET_DISK_CACHE_VERY_SIMPLE_VERY_SIMPLE_BACKEND_IMPL_H_ | |
| OLD | NEW |