OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BLOCKFILE_STORAGE_BLOCK_H_ | 7 #ifndef NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_ |
8 #define NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_ | 8 #define NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_ |
9 | 9 |
10 #include "net/disk_cache/blockfile/addr.h" | 10 #include "net/disk_cache/blockfile/addr.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // ModifySomething(b.Data()); | 27 // ModifySomething(b.Data()); |
28 // // Data modified on the previous call will be saved by b's destructor. | 28 // // Data modified on the previous call will be saved by b's destructor. |
29 // b.set_modified(); | 29 // b.set_modified(); |
30 template<typename T> | 30 template<typename T> |
31 class StorageBlock : public FileBlock { | 31 class StorageBlock : public FileBlock { |
32 public: | 32 public: |
33 StorageBlock(MappedFile* file, Addr address); | 33 StorageBlock(MappedFile* file, Addr address); |
34 virtual ~StorageBlock(); | 34 virtual ~StorageBlock(); |
35 | 35 |
36 // FileBlock interface. | 36 // FileBlock interface. |
37 virtual void* buffer() const; | 37 void* buffer() const override; |
38 virtual size_t size() const; | 38 size_t size() const override; |
39 virtual int offset() const; | 39 int offset() const override; |
40 | 40 |
41 // Allows the overide of dummy values passed on the constructor. | 41 // Allows the overide of dummy values passed on the constructor. |
42 bool LazyInit(MappedFile* file, Addr address); | 42 bool LazyInit(MappedFile* file, Addr address); |
43 | 43 |
44 // Sets the internal storage to share the memory provided by other instance. | 44 // Sets the internal storage to share the memory provided by other instance. |
45 void SetData(T* other); | 45 void SetData(T* other); |
46 | 46 |
47 // Deletes the data, even if it was modified and not saved. This object must | 47 // Deletes the data, even if it was modified and not saved. This object must |
48 // own the memory buffer (it cannot be shared). | 48 // own the memory buffer (it cannot be shared). |
49 void Discard(); | 49 void Discard(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool modified_; | 88 bool modified_; |
89 bool own_data_; // Is data_ owned by this object or shared with someone else. | 89 bool own_data_; // Is data_ owned by this object or shared with someone else. |
90 bool extended_; // Used to store an entry of more than one block. | 90 bool extended_; // Used to store an entry of more than one block. |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(StorageBlock); | 92 DISALLOW_COPY_AND_ASSIGN(StorageBlock); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace disk_cache | 95 } // namespace disk_cache |
96 | 96 |
97 #endif // NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_ | 97 #endif // NET_DISK_CACHE_BLOCKFILE_STORAGE_BLOCK_H_ |
OLD | NEW |