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 // See net/disk_cache/disk_cache.h for the public interface. | 5 // See net/disk_cache/disk_cache.h for the public interface. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_STORAGE_BLOCK_H__ | 7 #ifndef NET_DISK_CACHE_STORAGE_BLOCK_H__ |
8 #define NET_DISK_CACHE_STORAGE_BLOCK_H__ | 8 #define NET_DISK_CACHE_STORAGE_BLOCK_H__ |
9 | 9 |
10 #include "net/disk_cache/addr.h" | 10 #include "net/disk_cache/addr.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 virtual ~StorageBlock(); | 36 virtual ~StorageBlock(); |
37 | 37 |
38 // FileBlock interface. | 38 // FileBlock interface. |
39 virtual void* buffer() const; | 39 virtual void* buffer() const; |
40 virtual size_t size() const; | 40 virtual size_t size() const; |
41 virtual int offset() const; | 41 virtual int offset() const; |
42 | 42 |
43 // Allows the overide of dummy values passed on the constructor. | 43 // Allows the overide of dummy values passed on the constructor. |
44 bool LazyInit(MappedFile* file, Addr address); | 44 bool LazyInit(MappedFile* file, Addr address); |
45 | 45 |
46 // Sets the internal storage to share the momory provided by other instance. | 46 // Sets the internal storage to share the memory provided by other instance. |
47 void SetData(T* other); | 47 void SetData(T* other); |
48 | 48 |
| 49 // Deletes the data, even if it was modified and not saved. This object must |
| 50 // own the memory buffer (it cannot be shared). |
| 51 void Discard(); |
| 52 |
49 // Sets the object to lazily save the in-memory data on destruction. | 53 // Sets the object to lazily save the in-memory data on destruction. |
50 void set_modified(); | 54 void set_modified(); |
51 | 55 |
52 // Gets a pointer to the internal storage (allocates storage if needed). | 56 // Gets a pointer to the internal storage (allocates storage if needed). |
53 T* Data(); | 57 T* Data(); |
54 | 58 |
55 // Returns true if there is data associated with this object. | 59 // Returns true if there is data associated with this object. |
56 bool HasData() const; | 60 bool HasData() const; |
57 | 61 |
58 const Addr address() const; | 62 const Addr address() const; |
(...skipping 15 matching lines...) Expand all Loading... |
74 | 78 |
75 DISALLOW_EVIL_CONSTRUCTORS(StorageBlock); | 79 DISALLOW_EVIL_CONSTRUCTORS(StorageBlock); |
76 }; | 80 }; |
77 | 81 |
78 typedef StorageBlock<EntryStore> CacheEntryBlock; | 82 typedef StorageBlock<EntryStore> CacheEntryBlock; |
79 typedef StorageBlock<RankingsNode> CacheRankingsBlock; | 83 typedef StorageBlock<RankingsNode> CacheRankingsBlock; |
80 | 84 |
81 } // namespace disk_cache | 85 } // namespace disk_cache |
82 | 86 |
83 #endif // NET_DISK_CACHE_STORAGE_BLOCK_H__ | 87 #endif // NET_DISK_CACHE_STORAGE_BLOCK_H__ |
OLD | NEW |