OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... | |
24 // SimpleBackendImpl is a new cache backend that stores entries in individual | 24 // SimpleBackendImpl is a new cache backend that stores entries in individual |
25 // files. | 25 // files. |
26 | 26 |
27 // It is currently a work in progress, missing many features of a real cache, | 27 // It is currently a work in progress, missing many features of a real cache, |
28 // such as eviction. | 28 // such as eviction. |
29 | 29 |
30 // See http://www.chromium.org/developers/design-documents/network-stack/disk-ca che/very-simple-backend | 30 // See http://www.chromium.org/developers/design-documents/network-stack/disk-ca che/very-simple-backend |
31 | 31 |
32 class SimpleIndex; | 32 class SimpleIndex; |
33 | 33 |
34 class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend { | 34 class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend, |
35 public base::SupportsWeakPtr<SimpleBackendImpl> { | |
gavinp
2013/04/17 07:41:18
Is this indented correctly?
pasko-google - do not use
2013/04/17 19:47:52
unspecified? I've indented it to 4 spaces, let me
| |
35 public: | 36 public: |
36 SimpleBackendImpl(const base::FilePath& path, int max_bytes, | 37 SimpleBackendImpl(const base::FilePath& path, int max_bytes, |
37 net::CacheType type, | 38 net::CacheType type, |
38 const scoped_refptr<base::TaskRunner>& cache_thread, | 39 const scoped_refptr<base::TaskRunner>& cache_thread, |
39 net::NetLog* net_log); | 40 net::NetLog* net_log); |
40 | 41 |
41 virtual ~SimpleBackendImpl(); | 42 virtual ~SimpleBackendImpl(); |
42 | 43 |
43 // Must run on IO Thread. | 44 // Must run on IO Thread. |
44 int Init(const CompletionCallback& completion_callback); | 45 int Init(const CompletionCallback& completion_callback); |
(...skipping 19 matching lines...) Expand all Loading... | |
64 virtual void GetStats( | 65 virtual void GetStats( |
65 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; | 66 std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; |
66 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; | 67 virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; |
67 | 68 |
68 private: | 69 private: |
69 typedef base::Callback<void(int result)> InitializeIndexCallback; | 70 typedef base::Callback<void(int result)> InitializeIndexCallback; |
70 | 71 |
71 // Must run on IO Thread. | 72 // Must run on IO Thread. |
72 void InitializeIndex(const CompletionCallback& callback, int result); | 73 void InitializeIndex(const CompletionCallback& callback, int result); |
73 | 74 |
75 // Dooms all entries previously accessed between |initial_time| and | |
76 // |end_time|. Invoked when the index is ready. | |
77 void IndexReadyForDoom(const base::Time initial_time, | |
gavinp
2013/04/17 07:41:18
this const has no meaning. I wouldn't pass a base:
pasko-google - do not use
2013/04/17 19:47:52
Sure, I just blindly copied it from somewhere.
Do
| |
78 const base::Time end_time, | |
79 const CompletionCallback& callback, int result); | |
80 | |
74 // Try to create the directory if it doesn't exist. | 81 // Try to create the directory if it doesn't exist. |
75 // Must run on Cache Thread. | 82 // Must run on Cache Thread. |
76 static void CreateDirectory( | 83 static void CreateDirectory( |
77 base::MessageLoopProxy* io_thread, | 84 base::MessageLoopProxy* io_thread, |
78 const base::FilePath& path, | 85 const base::FilePath& path, |
79 const InitializeIndexCallback& initialize_index_callback); | 86 const InitializeIndexCallback& initialize_index_callback); |
80 | 87 |
81 const base::FilePath path_; | 88 const base::FilePath path_; |
82 scoped_ptr<SimpleIndex> index_; | 89 scoped_ptr<SimpleIndex> index_; |
83 const scoped_refptr<base::TaskRunner> cache_thread_; | 90 const scoped_refptr<base::TaskRunner> cache_thread_; |
84 }; | 91 }; |
85 | 92 |
86 } // namespace disk_cache | 93 } // namespace disk_cache |
87 | 94 |
88 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 95 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ |
OLD | NEW |