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 14 matching lines...) Expand all Loading... |
25 virtual void Close(); | 25 virtual void Close(); |
26 virtual std::string GetKey() const; | 26 virtual std::string GetKey() const; |
27 virtual base::Time GetLastUsed() const; | 27 virtual base::Time GetLastUsed() const; |
28 virtual base::Time GetLastModified() const; | 28 virtual base::Time GetLastModified() const; |
29 virtual int32 GetDataSize(int index) const; | 29 virtual int32 GetDataSize(int index) const; |
30 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, | 30 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, |
31 net::CompletionCallback* completion_callback); | 31 net::CompletionCallback* completion_callback); |
32 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, | 32 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, |
33 net::CompletionCallback* completion_callback, | 33 net::CompletionCallback* completion_callback, |
34 bool truncate); | 34 bool truncate); |
| 35 virtual base::PlatformFile UseExternalFile(int index); |
| 36 virtual base::PlatformFile GetPlatformFile(int index); |
35 | 37 |
36 inline CacheEntryBlock* entry() { | 38 inline CacheEntryBlock* entry() { |
37 return &entry_; | 39 return &entry_; |
38 } | 40 } |
39 | 41 |
40 inline CacheRankingsBlock* rankings() { | 42 inline CacheRankingsBlock* rankings() { |
41 return &node_; | 43 return &node_; |
42 } | 44 } |
43 | 45 |
44 uint32 GetHash(); | 46 uint32 GetHash(); |
45 | 47 |
46 // Performs the initialization of a EntryImpl that will be added to the | 48 // Performs the initialization of a EntryImpl that will be added to the |
47 // cache. | 49 // cache. |
48 bool CreateEntry(Addr node_address, const std::string& key, | 50 bool CreateEntry(Addr node_address, const std::string& key, uint32 hash); |
49 uint32 hash); | |
50 | 51 |
51 // Returns true if this entry matches the lookup arguments. | 52 // Returns true if this entry matches the lookup arguments. |
52 bool IsSameEntry(const std::string& key, uint32 hash); | 53 bool IsSameEntry(const std::string& key, uint32 hash); |
53 | 54 |
54 // Permamently destroys this entry | 55 // Permamently destroys this entry |
55 void InternalDoom(); | 56 void InternalDoom(); |
56 | 57 |
57 // Returns the address of the next entry on the list of entries with the same | 58 // Returns the address of the next entry on the list of entries with the same |
58 // hash. | 59 // hash. |
59 CacheAddr GetNextAddress(); | 60 CacheAddr GetNextAddress(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void Log(const char* msg); | 134 void Log(const char* msg); |
134 | 135 |
135 CacheEntryBlock entry_; // Key related information for this entry. | 136 CacheEntryBlock entry_; // Key related information for this entry. |
136 CacheRankingsBlock node_; // Rankings related information for this entry. | 137 CacheRankingsBlock node_; // Rankings related information for this entry. |
137 BackendImpl* backend_; // Back pointer to the cache. | 138 BackendImpl* backend_; // Back pointer to the cache. |
138 scoped_array<char> user_buffers_[NUM_STREAMS]; // Store user data. | 139 scoped_array<char> user_buffers_[NUM_STREAMS]; // Store user data. |
139 scoped_refptr<File> files_[NUM_STREAMS + 1]; // Files to store external user | 140 scoped_refptr<File> files_[NUM_STREAMS + 1]; // Files to store external user |
140 // data and key. | 141 // data and key. |
141 int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. | 142 int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. |
142 bool doomed_; // True if this entry was removed from the cache. | 143 bool doomed_; // True if this entry was removed from the cache. |
143 | 144 bool need_file_[NUM_STREAMS]; // True if stream is prepared as an external |
| 145 // file. |
144 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); | 146 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); |
145 }; | 147 }; |
146 | 148 |
147 } // namespace disk_cache | 149 } // namespace disk_cache |
148 | 150 |
149 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ | 151 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ |
150 | 152 |
OLD | NEW |