| 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> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/task_runner.h" | 15 #include "base/task_runner.h" |
| 15 #include "net/base/cache_type.h" | 16 #include "net/base/cache_type.h" |
| 16 #include "net/disk_cache/disk_cache.h" | 17 #include "net/disk_cache/disk_cache.h" |
| 18 #include "net/disk_cache/simple/simple_index.h" |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| 19 class MessageLoopProxy; | 21 class MessageLoopProxy; |
| 20 } | 22 } |
| 21 | 23 |
| 22 namespace disk_cache { | 24 namespace disk_cache { |
| 23 | 25 |
| 24 // SimpleBackendImpl is a new cache backend that stores entries in individual | 26 // SimpleBackendImpl is a new cache backend that stores entries in individual |
| 25 // files. | 27 // files. |
| 26 | 28 |
| 27 // It is currently a work in progress, missing many features of a real cache, | 29 // It is currently a work in progress, missing many features of a real cache, |
| 28 // such as eviction. | 30 // such as eviction. |
| 29 | 31 |
| 30 // See http://www.chromium.org/developers/design-documents/network-stack/disk-ca
che/very-simple-backend | 32 // See http://www.chromium.org/developers/design-documents/network-stack/disk-ca
che/very-simple-backend |
| 31 | 33 |
| 32 class SimpleIndex; | |
| 33 | |
| 34 class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend { | 34 class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend { |
| 35 public: | 35 public: |
| 36 SimpleBackendImpl(const base::FilePath& path, int max_bytes, | 36 SimpleBackendImpl(const base::FilePath& path, int max_bytes, |
| 37 net::CacheType type, | 37 net::CacheType type, |
| 38 const scoped_refptr<base::TaskRunner>& cache_thread, | 38 const scoped_refptr<base::TaskRunner>& cache_thread, |
| 39 net::NetLog* net_log); | 39 net::NetLog* net_log); |
| 40 | 40 |
| 41 virtual ~SimpleBackendImpl(); | 41 virtual ~SimpleBackendImpl(); |
| 42 | 42 |
| 43 // Must run on IO Thread. | 43 // Must run on IO Thread. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 72 void InitializeIndex(const CompletionCallback& callback, int result); | 72 void InitializeIndex(const CompletionCallback& callback, int result); |
| 73 | 73 |
| 74 // Try to create the directory if it doesn't exist. | 74 // Try to create the directory if it doesn't exist. |
| 75 // Must run on Cache Thread. | 75 // Must run on Cache Thread. |
| 76 static void CreateDirectory( | 76 static void CreateDirectory( |
| 77 base::MessageLoopProxy* io_thread, | 77 base::MessageLoopProxy* io_thread, |
| 78 const base::FilePath& path, | 78 const base::FilePath& path, |
| 79 const InitializeIndexCallback& initialize_index_callback); | 79 const InitializeIndexCallback& initialize_index_callback); |
| 80 | 80 |
| 81 const base::FilePath path_; | 81 const base::FilePath path_; |
| 82 scoped_ptr<SimpleIndex> index_; | 82 scoped_refptr<SimpleIndex> index_; |
| 83 const scoped_refptr<base::TaskRunner> cache_thread_; | 83 const scoped_refptr<base::TaskRunner> cache_thread_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace disk_cache | 86 } // namespace disk_cache |
| 87 | 87 |
| 88 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 88 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ |
| OLD | NEW |