| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // calls are queued up and serviced once the disk_cache::Backend is | 22 // calls are queued up and serviced once the disk_cache::Backend is |
| 23 // really ready to go. | 23 // really ready to go. |
| 24 class AppCacheDiskCache { | 24 class AppCacheDiskCache { |
| 25 public: | 25 public: |
| 26 AppCacheDiskCache(); | 26 AppCacheDiskCache(); |
| 27 ~AppCacheDiskCache(); | 27 ~AppCacheDiskCache(); |
| 28 | 28 |
| 29 // Initializes the object to use disk backed storage. | 29 // Initializes the object to use disk backed storage. |
| 30 int InitWithDiskBackend(const FilePath& disk_cache_directory, | 30 int InitWithDiskBackend(const FilePath& disk_cache_directory, |
| 31 int disk_cache_size, bool force, | 31 int disk_cache_size, bool force, |
| 32 base::MessageLoopProxy* cache_thread, |
| 32 net::CompletionCallback* callback); | 33 net::CompletionCallback* callback); |
| 33 | 34 |
| 34 // Initializes the object to use memory only storage. | 35 // Initializes the object to use memory only storage. |
| 35 // This is used for Chrome's incognito browsing. | 36 // This is used for Chrome's incognito browsing. |
| 36 int InitWithMemBackend(int disk_cache_size, | 37 int InitWithMemBackend(int disk_cache_size, |
| 37 net::CompletionCallback* callback); | 38 net::CompletionCallback* callback); |
| 38 | 39 |
| 39 void Disable(); | 40 void Disable(); |
| 40 bool is_disabled() const { return is_disabled_; } | 41 bool is_disabled() const { return is_disabled_; } |
| 41 | 42 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 PendingCall(PendingCallType call_type, int64 key, | 79 PendingCall(PendingCallType call_type, int64 key, |
| 79 disk_cache::Entry** entry, net::CompletionCallback* callback) | 80 disk_cache::Entry** entry, net::CompletionCallback* callback) |
| 80 : call_type(call_type), key(key), entry(entry), callback(callback) {} | 81 : call_type(call_type), key(key), entry(entry), callback(callback) {} |
| 81 }; | 82 }; |
| 82 typedef std::vector<PendingCall> PendingCalls; | 83 typedef std::vector<PendingCall> PendingCalls; |
| 83 | 84 |
| 84 bool is_initializing() const { | 85 bool is_initializing() const { |
| 85 return create_backend_callback_.get() != NULL; | 86 return create_backend_callback_.get() != NULL; |
| 86 } | 87 } |
| 87 int Init(net::CacheType cache_type, const FilePath& directory, | 88 int Init(net::CacheType cache_type, const FilePath& directory, |
| 88 int cache_size, bool force, net::CompletionCallback* callback); | 89 int cache_size, bool force, base::MessageLoopProxy* cache_thread, |
| 90 net::CompletionCallback* callback); |
| 89 void OnCreateBackendComplete(int rv); | 91 void OnCreateBackendComplete(int rv); |
| 90 | 92 |
| 91 bool is_disabled_; | 93 bool is_disabled_; |
| 92 net::CompletionCallback* init_callback_; | 94 net::CompletionCallback* init_callback_; |
| 93 scoped_refptr<CreateBackendCallback> create_backend_callback_; | 95 scoped_refptr<CreateBackendCallback> create_backend_callback_; |
| 94 PendingCalls pending_calls_; | 96 PendingCalls pending_calls_; |
| 95 scoped_ptr<disk_cache::Backend> disk_cache_; | 97 scoped_ptr<disk_cache::Backend> disk_cache_; |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace appcache | 100 } // namespace appcache |
| 99 | 101 |
| 100 #endif // WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ | 102 #endif // WEBKIT_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| 101 | 103 |
| OLD | NEW |