Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 bool is_disabled() const { return is_disabled_; } | 45 bool is_disabled() const { return is_disabled_; } |
| 46 | 46 |
| 47 int CreateEntry(int64 key, | 47 int CreateEntry(int64 key, |
| 48 Entry** entry, | 48 Entry** entry, |
| 49 const net::CompletionCallback& callback) override; | 49 const net::CompletionCallback& callback) override; |
| 50 int OpenEntry(int64 key, | 50 int OpenEntry(int64 key, |
| 51 Entry** entry, | 51 Entry** entry, |
| 52 const net::CompletionCallback& callback) override; | 52 const net::CompletionCallback& callback) override; |
| 53 int DoomEntry(int64 key, const net::CompletionCallback& callback) override; | 53 int DoomEntry(int64 key, const net::CompletionCallback& callback) override; |
| 54 | 54 |
| 55 protected: | |
| 56 explicit AppCacheDiskCache(bool use_simple_cache); | |
| 57 | |
| 55 private: | 58 private: |
| 56 class CreateBackendCallbackShim; | 59 class CreateBackendCallbackShim; |
| 57 class EntryImpl; | 60 class EntryImpl; |
| 58 | 61 |
| 59 // PendingCalls allow CreateEntry, OpenEntry, and DoomEntry to be called | 62 // PendingCalls allow CreateEntry, OpenEntry, and DoomEntry to be called |
| 60 // immediately after construction, without waiting for the | 63 // immediately after construction, without waiting for the |
| 61 // underlying disk_cache::Backend to be fully constructed. Early | 64 // underlying disk_cache::Backend to be fully constructed. Early |
| 62 // calls are queued up and serviced once the disk_cache::Backend is | 65 // calls are queued up and serviced once the disk_cache::Backend is |
| 63 // really ready to go. | 66 // really ready to go. |
| 64 enum PendingCallType { | 67 enum PendingCallType { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 94 int cache_size, | 97 int cache_size, |
| 95 bool force, | 98 bool force, |
| 96 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, | 99 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, |
| 97 const net::CompletionCallback& callback); | 100 const net::CompletionCallback& callback); |
| 98 void OnCreateBackendComplete(int rv); | 101 void OnCreateBackendComplete(int rv); |
| 99 void AddActiveCall(ActiveCall* call) { active_calls_.insert(call); } | 102 void AddActiveCall(ActiveCall* call) { active_calls_.insert(call); } |
| 100 void RemoveActiveCall(ActiveCall* call) { active_calls_.erase(call); } | 103 void RemoveActiveCall(ActiveCall* call) { active_calls_.erase(call); } |
| 101 void AddOpenEntry(EntryImpl* entry) { open_entries_.insert(entry); } | 104 void AddOpenEntry(EntryImpl* entry) { open_entries_.insert(entry); } |
| 102 void RemoveOpenEntry(EntryImpl* entry) { open_entries_.erase(entry); } | 105 void RemoveOpenEntry(EntryImpl* entry) { open_entries_.erase(entry); } |
| 103 | 106 |
| 104 bool is_disabled_; | 107 bool use_simple_cache_ = false; |
|
kinuko
2015/05/15 02:28:48
nit: we initialize this differently in ctors, it's
nhiroki
2015/05/15 03:02:47
Done.
| |
| 108 bool is_disabled_ = false; | |
| 105 net::CompletionCallback init_callback_; | 109 net::CompletionCallback init_callback_; |
| 106 scoped_refptr<CreateBackendCallbackShim> create_backend_callback_; | 110 scoped_refptr<CreateBackendCallbackShim> create_backend_callback_; |
| 107 PendingCalls pending_calls_; | 111 PendingCalls pending_calls_; |
| 108 ActiveCalls active_calls_; | 112 ActiveCalls active_calls_; |
| 109 OpenEntries open_entries_; | 113 OpenEntries open_entries_; |
| 110 scoped_ptr<disk_cache::Backend> disk_cache_; | 114 scoped_ptr<disk_cache::Backend> disk_cache_; |
| 111 }; | 115 }; |
| 112 | 116 |
| 113 } // namespace content | 117 } // namespace content |
| 114 | 118 |
| 115 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ | 119 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DISK_CACHE_H_ |
| OLD | NEW |