| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_ENTRY_IMPL_H__ | 5 #ifndef NET_DISK_CACHE_ENTRY_IMPL_H__ |
| 6 #define NET_DISK_CACHE_ENTRY_IMPL_H__ | 6 #define NET_DISK_CACHE_ENTRY_IMPL_H__ |
| 7 | 7 |
| 8 #include "net/disk_cache/disk_cache.h" | 8 #include "net/disk_cache/disk_cache.h" |
| 9 #include "net/disk_cache/storage_block.h" | 9 #include "net/disk_cache/storage_block.h" |
| 10 #include "net/disk_cache/storage_block-inl.h" | 10 #include "net/disk_cache/storage_block-inl.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Handle the pending asynchronous IO count. | 83 // Handle the pending asynchronous IO count. |
| 84 void IncrementIoCount(); | 84 void IncrementIoCount(); |
| 85 void DecrementIoCount(); | 85 void DecrementIoCount(); |
| 86 | 86 |
| 87 // Set the access times for this entry. This method provides support for | 87 // Set the access times for this entry. This method provides support for |
| 88 // the upgrade tool. | 88 // the upgrade tool. |
| 89 void SetTimes(base::Time last_used, base::Time last_modified); | 89 void SetTimes(base::Time last_used, base::Time last_modified); |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 enum { |
| 93 NUM_STREAMS = 3 |
| 94 }; |
| 95 |
| 92 ~EntryImpl(); | 96 ~EntryImpl(); |
| 93 | 97 |
| 94 // Index for the file used to store the key, if any (files_[kKeyFileIndex]). | |
| 95 static const int kKeyFileIndex = 2; | |
| 96 | |
| 97 // Initializes the storage for an internal or external data block. | 98 // Initializes the storage for an internal or external data block. |
| 98 bool CreateDataBlock(int index, int size); | 99 bool CreateDataBlock(int index, int size); |
| 99 | 100 |
| 100 // Initializes the storage for an internal or external generic block. | 101 // Initializes the storage for an internal or external generic block. |
| 101 bool CreateBlock(int size, Addr* address); | 102 bool CreateBlock(int size, Addr* address); |
| 102 | 103 |
| 103 // Deletes the data pointed by address, maybe backed by files_[index]. | 104 // Deletes the data pointed by address, maybe backed by files_[index]. |
| 104 void DeleteData(Addr address, int index); | 105 void DeleteData(Addr address, int index); |
| 105 | 106 |
| 106 // Updates ranking information. | 107 // Updates ranking information. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 | 128 |
| 128 // Flush the in-memory data to the backing storage. | 129 // Flush the in-memory data to the backing storage. |
| 129 bool Flush(int index, int size, bool async); | 130 bool Flush(int index, int size, bool async); |
| 130 | 131 |
| 131 // Logs this entry to the internal trace buffer. | 132 // Logs this entry to the internal trace buffer. |
| 132 void Log(const char* msg); | 133 void Log(const char* msg); |
| 133 | 134 |
| 134 CacheEntryBlock entry_; // Key related information for this entry. | 135 CacheEntryBlock entry_; // Key related information for this entry. |
| 135 CacheRankingsBlock node_; // Rankings related information for this entry. | 136 CacheRankingsBlock node_; // Rankings related information for this entry. |
| 136 BackendImpl* backend_; // Back pointer to the cache. | 137 BackendImpl* backend_; // Back pointer to the cache. |
| 137 scoped_array<char> user_buffers_[2]; // Store user data. | 138 scoped_array<char> user_buffers_[NUM_STREAMS]; // Store user data. |
| 138 scoped_refptr<File> files_[3]; // Files to store external user data and key. | 139 scoped_refptr<File> files_[NUM_STREAMS + 1]; // Files to store external user |
| 139 int unreported_size_[2]; // Bytes not reported yet to the backend. | 140 // data and key. |
| 141 int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. |
| 140 bool doomed_; // True if this entry was removed from the cache. | 142 bool doomed_; // True if this entry was removed from the cache. |
| 141 | 143 |
| 142 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); | 144 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); |
| 143 }; | 145 }; |
| 144 | 146 |
| 145 } // namespace disk_cache | 147 } // namespace disk_cache |
| 146 | 148 |
| 147 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ | 149 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ |
| 148 | 150 |
| OLD | NEW |