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" |
11 | 11 |
12 namespace disk_cache { | 12 namespace disk_cache { |
13 | 13 |
14 class BackendImpl; | 14 class BackendImpl; |
15 | 15 |
16 // This class implements the Entry interface. An object of this | 16 // This class implements the Entry interface. An object of this |
17 // class represents a single entry on the cache. | 17 // class represents a single entry on the cache. |
18 class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { | 18 class EntryImpl : public Entry, public base::RefCounted<EntryImpl> { |
19 friend class base::RefCounted<EntryImpl>; | 19 friend class base::RefCounted<EntryImpl>; |
20 public: | 20 public: |
21 EntryImpl(BackendImpl* backend, Addr address); | 21 EntryImpl(BackendImpl* backend, Addr address); |
22 | 22 |
23 // Entry interface. | 23 // Entry interface. |
24 virtual void Doom(); | 24 virtual void Doom(); |
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, char* 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, const char* 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 | 35 |
36 inline CacheEntryBlock* entry() { | 36 inline CacheEntryBlock* entry() { |
37 return &entry_; | 37 return &entry_; |
38 } | 38 } |
39 | 39 |
40 inline CacheRankingsBlock* rankings() { | 40 inline CacheRankingsBlock* rankings() { |
41 return &node_; | 41 return &node_; |
42 } | 42 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. | 141 int unreported_size_[NUM_STREAMS]; // Bytes not reported yet to the backend. |
142 bool doomed_; // True if this entry was removed from the cache. | 142 bool doomed_; // True if this entry was removed from the cache. |
143 | 143 |
144 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); | 144 DISALLOW_EVIL_CONSTRUCTORS(EntryImpl); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace disk_cache | 147 } // namespace disk_cache |
148 | 148 |
149 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ | 149 #endif // NET_DISK_CACHE_ENTRY_IMPL_H__ |
150 | 150 |
OLD | NEW |