Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: net/disk_cache/flash/internal_entry.h

Issue 12847012: Adding disk_cache::Entry implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implemented Init. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
34 : public base::RefCounted<InternalEntry> {
35 friend class base::RefCounted<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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698