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