Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_DISK_CACHE_FLASH_LOG_ENTRY_H_ | |
| 6 #define NET_DISK_CACHE_FLASH_LOG_ENTRY_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/gtest_prod_util.h" | |
| 12 #include "net/base/net_export.h" | |
| 13 #include "net/disk_cache/flash/format.h" | |
| 14 | |
| 15 namespace net { | |
| 16 class IOBuffer; | |
| 17 }; | |
| 18 | |
| 19 namespace disk_cache { | |
| 20 | |
| 21 class LogStructuredStore; | |
| 22 | |
| 23 class NET_EXPORT_PRIVATE CacheEntry { | |
| 24 public: | |
| 25 explicit CacheEntry(LogStructuredStore* store); | |
| 26 CacheEntry(LogStructuredStore* store, int32 id); | |
| 27 ~CacheEntry(); | |
| 28 | |
| 29 bool Init(); | |
| 30 bool Close(); | |
| 31 | |
| 32 int32 id() const; | |
| 33 int32 GetDataSize(int index) const; | |
| 34 | |
| 35 int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len); | |
| 36 int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len); | |
| 37 | |
| 38 private: | |
| 39 bool OnDisk() const; | |
| 40 bool ValidStream(int stream_index) const; | |
| 41 int32 Size() const; | |
| 42 bool Save(); | |
| 43 bool LazyRead(int index); | |
| 44 | |
| 45 LogStructuredStore* store_; | |
| 46 int32 id_; | |
| 47 | |
| 48 struct Stream { | |
|
rvargas (doing something else)
2012/11/28 03:12:56
types go before methods
agayev
2012/11/29 16:14:43
Done.
| |
| 49 Stream() : offset(0), insync(false) {} | |
|
rvargas (doing something else)
2012/11/28 03:12:56
cannot be inline
agayev
2012/11/29 16:14:43
Done.
| |
| 50 int offset; | |
| 51 std::vector<char> data; | |
| 52 bool insync; | |
|
rvargas (doing something else)
2012/11/28 03:12:56
insync?
agayev
2012/11/29 16:14:43
Means in sync with the store.
rvargas (doing something else)
2012/11/29 20:32:36
Then, at the very least it should be in_sync (but
| |
| 53 }; | |
| 54 | |
| 55 Stream streams_[kFlashCacheEntryNumStreams]; | |
| 56 | |
| 57 bool init_; | |
| 58 bool closed_; | |
| 59 bool modified_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(CacheEntry); | |
| 62 }; | |
| 63 | |
| 64 } // namespace disk_cache | |
| 65 | |
| 66 #endif // NET_DISK_CACHE_FLASH_LOG_ENTRY_H_ | |
| OLD | NEW |