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_INTERNAL_ENTRY_H_ | |
| 6 #define NET_DISK_CACHE_FLASH_INTERNAL_ENTRY_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "net/base/completion_callback.h" | |
| 13 #include "net/base/net_export.h" | |
| 14 #include "net/disk_cache/flash/format.h" | |
| 15 | |
| 16 namespace net { | |
| 17 | |
| 18 class IOBuffer; | |
| 19 | |
| 20 } // namespace net | |
| 21 | |
| 22 namespace disk_cache { | |
| 23 | |
| 24 struct KeyAndStreamSizes { | |
| 25 KeyAndStreamSizes(); | |
| 26 std::string key; | |
| 27 int stream_sizes[kFlashLogStoreEntryNumStreams]; | |
| 28 }; | |
| 29 | |
| 30 class LogStore; | |
| 31 class LogStoreEntry; | |
| 32 | |
| 33 class NET_EXPORT_PRIVATE InternalEntry | |
|
rvargas (doing something else)
2013/04/05 18:15:41
nit: Add a class description. One sentence would b
agayev
2013/04/05 22:26:45
Done.
| |
| 34 : public base::RefCountedThreadSafe<InternalEntry> { | |
| 35 friend class base::RefCountedThreadSafe<InternalEntry>; | |
| 36 public: | |
| 37 InternalEntry(const std::string& key, LogStore* store); | |
| 38 InternalEntry(int32 id, LogStore* store); | |
| 39 ~InternalEntry(); | |
| 40 | |
| 41 scoped_ptr<KeyAndStreamSizes> Init(); | |
| 42 int32 GetDataSize(int index) const; | |
| 43 int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len, | |
| 44 const net::CompletionCallback& callback); | |
| 45 int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, | |
| 46 const net::CompletionCallback& callback); | |
| 47 void Close(); | |
| 48 | |
| 49 private: | |
| 50 bool WriteKey(LogStoreEntry* entry, const std::string& key); | |
| 51 bool ReadKey(LogStoreEntry* entry, std::string* key); | |
| 52 | |
| 53 LogStore* store_; | |
| 54 scoped_ptr<LogStoreEntry> entry_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(InternalEntry); | |
| 57 }; | |
| 58 | |
| 59 } // namespace disk_cache | |
| 60 | |
| 61 #endif // NET_DISK_CACHE_FLASH_INTERNAL_ENTRY_H_ | |
| OLD | NEW |