OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ |
6 #define NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ |
7 | 7 |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "net/disk_cache/disk_cache.h" | 10 #include "net/disk_cache/disk_cache.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual int32 GetDataSize(int index) const; | 60 virtual int32 GetDataSize(int index) const; |
61 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, | 61 virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, |
62 net::CompletionCallback* completion_callback); | 62 net::CompletionCallback* completion_callback); |
63 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, | 63 virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, |
64 net::CompletionCallback* completion_callback, | 64 net::CompletionCallback* completion_callback, |
65 bool truncate); | 65 bool truncate); |
66 virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, | 66 virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, |
67 net::CompletionCallback* completion_callback); | 67 net::CompletionCallback* completion_callback); |
68 virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, | 68 virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, |
69 net::CompletionCallback* completion_callback); | 69 net::CompletionCallback* completion_callback); |
70 virtual int GetAvailableRange(int64 offset, int len, int64* start); | |
71 virtual int GetAvailableRange(int64 offset, int len, int64* start, | 70 virtual int GetAvailableRange(int64 offset, int len, int64* start, |
72 CompletionCallback* callback); | 71 CompletionCallback* callback); |
73 virtual bool CouldBeSparse() const; | 72 virtual bool CouldBeSparse() const; |
74 virtual void CancelSparseIO() {} | 73 virtual void CancelSparseIO() {} |
75 virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); | 74 virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback); |
76 | 75 |
77 // Performs the initialization of a EntryImpl that will be added to the | 76 // Performs the initialization of a EntryImpl that will be added to the |
78 // cache. | 77 // cache. |
79 bool CreateEntry(const std::string& key); | 78 bool CreateEntry(const std::string& key); |
80 | 79 |
(...skipping 25 matching lines...) Expand all Loading... |
106 | 105 |
107 private: | 106 private: |
108 typedef base::hash_map<int, MemEntryImpl*> EntryMap; | 107 typedef base::hash_map<int, MemEntryImpl*> EntryMap; |
109 | 108 |
110 enum { | 109 enum { |
111 NUM_STREAMS = 3 | 110 NUM_STREAMS = 3 |
112 }; | 111 }; |
113 | 112 |
114 ~MemEntryImpl(); | 113 ~MemEntryImpl(); |
115 | 114 |
| 115 // Old Entry interface. |
| 116 int GetAvailableRange(int64 offset, int len, int64* start); |
| 117 |
116 // Grows and cleans up the data buffer. | 118 // Grows and cleans up the data buffer. |
117 void PrepareTarget(int index, int offset, int buf_len); | 119 void PrepareTarget(int index, int offset, int buf_len); |
118 | 120 |
119 // Updates ranking information. | 121 // Updates ranking information. |
120 void UpdateRank(bool modified); | 122 void UpdateRank(bool modified); |
121 | 123 |
122 // Initializes the children map and sparse info. This method is only called | 124 // Initializes the children map and sparse info. This method is only called |
123 // on a parent entry. | 125 // on a parent entry. |
124 bool InitSparseInfo(); | 126 bool InitSparseInfo(); |
125 | 127 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 base::Time last_used_; | 161 base::Time last_used_; |
160 MemBackendImpl* backend_; // Back pointer to the cache. | 162 MemBackendImpl* backend_; // Back pointer to the cache. |
161 bool doomed_; // True if this entry was removed from the cache. | 163 bool doomed_; // True if this entry was removed from the cache. |
162 | 164 |
163 DISALLOW_COPY_AND_ASSIGN(MemEntryImpl); | 165 DISALLOW_COPY_AND_ASSIGN(MemEntryImpl); |
164 }; | 166 }; |
165 | 167 |
166 } // namespace disk_cache | 168 } // namespace disk_cache |
167 | 169 |
168 #endif // NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ | 170 #endif // NET_DISK_CACHE_MEM_ENTRY_IMPL_H_ |
OLD | NEW |