| 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_STORE_ENTRY_H_ | |
| 6 #define NET_DISK_CACHE_FLASH_LOG_STORE_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 LogStore; | |
| 22 | |
| 23 class NET_EXPORT_PRIVATE LogStoreEntry { | |
| 24 public: | |
| 25 explicit LogStoreEntry(LogStore* store); | |
| 26 LogStoreEntry(LogStore* store, int32 id); | |
| 27 ~LogStoreEntry(); | |
| 28 | |
| 29 bool Init(); | |
| 30 bool Close(); | |
| 31 | |
| 32 int32 id() const; | |
| 33 bool IsNew() const; | |
| 34 int32 GetDataSize(int index) const; | |
| 35 | |
| 36 int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len); | |
| 37 int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len); | |
| 38 void Delete(); | |
| 39 | |
| 40 private: | |
| 41 struct Stream { | |
| 42 Stream(); | |
| 43 ~Stream(); | |
| 44 int offset; | |
| 45 int size; | |
| 46 std::vector<char> write_buffer; | |
| 47 }; | |
| 48 | |
| 49 bool InvalidStream(int stream_index) const; | |
| 50 int32 Size() const; | |
| 51 bool Save(); | |
| 52 | |
| 53 LogStore* store_; | |
| 54 int32 id_; | |
| 55 Stream streams_[kFlashLogStoreEntryNumStreams]; | |
| 56 bool init_; | |
| 57 bool closed_; | |
| 58 bool deleted_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(LogStoreEntry); | |
| 61 }; | |
| 62 | |
| 63 } // namespace disk_cache | |
| 64 | |
| 65 #endif // NET_DISK_CACHE_FLASH_LOG_STORE_ENTRY_H_ | |
| OLD | NEW |